Skip to content

Instantly share code, notes, and snippets.

@BrennanConroy
Last active March 6, 2017 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrennanConroy/fc3210dbf59a10f5c4ee34df9706e682 to your computer and use it in GitHub Desktop.
Save BrennanConroy/fc3210dbf59a10f5c4ee34df9706e682 to your computer and use it in GitHub Desktop.
Logging Config + Filter
{
"Logging": {
"Default": {
"LogLevel": {
"Microsoft.AspNetCore": "Critical",
"System": "Warning"
}
},
"DebugLogger": { // do these override "Default" section above?
"LogLevel": {
"System": "Information",
"Microsoft": "Warning"
}
},
"ConsoleLogger": {
"SomeName": {
"LogLevel": {
"System": "Critical"
}
},
"LogLevel": {
"Microsoft": "Error"
}
},
"TraceSourceLogger": {
"LogLevel": {
"System": "Error",
"WebApplication2.MyApp": "Trace"
}
},
"SomeName": {
"LogLevel": {
"System": "Critical"
}
}
}
}
API Changes:
- public interface ILoggerFactory -> Add "void AddProvider(ILoggerProvider provider, string providerName)"
- public interface ILoggerFactory -> Add "void AddFilter(Func<string, LogLevel, bool> filter)"
- public interface ILoggerFactory -> Add "void AddFilter(IConfiguration configuration)"
- public static ILoggerFactory AddConsole(this ILoggerFactory factory, IConfiguration configuration) -> obsolete
- obsolete all of "Microsoft.AspNetCore.Logging.Filter"
Q: AddConsole and AdddDebug have "Func<string, LogLevel, bool> filter" overloads, should other loggers have this? Like AddEventLog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment