private static LayoutWithHeaderAndFooter BuildLayout() { var layout = new LayoutWithHeaderAndFooter(); Guid guid = Guid.NewGuid(); layout.Header = string.Concat(Separator, "${newline}Guid: ", guid.ToString(), "${newline}${date:format=dddd dd MMMM yyyy}${newline}${date:format=T}${newline}Login: ${windows-identity}${newline}Machine: ${machinename}${newline}Version: ${gdc:item=version}${newline}", Separator); //layout.Layout = "${level:uppercase=true} ${logger}: ${message}${onexception:inner=${newline}${exception:format=tostring}}"; layout.Layout = "${message}${onexception:inner=${newline}${exception:format=tostring}}"; layout.Footer = string.Concat(Separator, "${newline}", guid.ToString(), " - ${date:format=T} - ${qpc}s${newline}", Separator); return layout; }
/// <summary> /// Creates a new instance of <see cref="TargetWithLayout" /> /// </summary> protected TargetWithLayoutHeaderAndFooter() { LayoutWithHeaderAndFooter h = new LayoutWithHeaderAndFooter(); h.Layout = new Layout("${longdate}|${level:uppercase=true}|${logger}|${message}"); CompiledLayout = h; }