Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Changes to Logging API surface #331

Closed
@muratg

Description

@muratg
  • Have all levels (Critical, Debug, Error, Warning, Information, Verbose) have the same overloads as extension methods:
    • Log....(this ILogger logger, EventId eventId, Exception exception, string message, params object[] args);
    • Log....(this ILogger logger, EventId eventId, string message, params object[] args);
    • Log....(this ILogger logger, string message, params object[] args);
  • EventId has implicit conversion from/to Int and if you want to use string, you do the conversion yourself
  • Our frameworks will be passing in both int and string based EventIds.
  • Event IDs (string versions) in our frameworks should be PascalCased and should typically be two words. Some examples:
    • "QueryExecuting"
    • "ActionExecuting"
    • "ContentNegotiationFailed"
    • ...
  • Change the LoggerMessage.Define to take an EventId instead of int
    • There may be other places where int eventId could be used. Convert them to EventId.
  • MessageFormatter should be state to string (and not do formatting at all)
  • MessageFormatter state should never be null, null check shouldn’t be done in runtime
  • Remove ILogValues and use IReadOnlyList<KeyValuePair<string, object>>
  • ILogger change: Instead of void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter) we should use void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions