-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Based on comment from @cassandra-d on StackOverflow:
Good answer and good work with nuget. A little bit unfortunate that that enricher works only globally and you can't set properties per logger instance to use it for distributed logging.
Given that enrichers are not sink-specific, I'm thinking that we would need to introduce something like "named contexts", and instruct the user to use sub-loggers to configure the enricher separately. It would look similar to the below (pseudo-code):
var consoleContext = GlobalLogContext.Create("Console");
var fileContext = GlobalLogContext.Create("File");
Log.Logger = new LoggerConfiguration()
.WriteTo.Logger(lc => lc
.WriteTo.Console()
.Enrich.FromGlobalContext(consoleContext)
)
.WriteTo.Logger(lc => lc
.WriteTo.File("log.txt")
.Enrich.FromGlobalContext(fileContext)
)
.CreateLogger();Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request