Serilog - Output/Enrich All Messages with MethodName from which log entry was Called -
Serilog - Output/Enrich All Messages with MethodName from which log entry was Called -
is there anyway enrich serilog output method name.
for instance consider if have following;
public class myclassname private function myfunctionname() boolean logger.information("hello world") homecoming true end function end class the desired output follows;
2015-04-06 18:41:35.361 +10:00 [information] [myfunctionname] hello world! actually qualified name good.
2015-04-06 18:41:35.361 +10:00 [information] [myclassname.myfunctionname] hello world! it seems "enrichers" static info , won't work each time.
it's possible enricher reflecting on phone call stack, expensive so, serilog doesn't offer it.
instead can utilize like:
logger.here().information("hello, world!"); and implement here() method extension method on ilogger:
<extension> public sub here(byval logger ilogger, <callermembername> optional membername string = nothing) homecoming logger.forcontext("membername", membername) end sub serilog
Comments
Post a Comment