Every log event consists of five components:
- Levels indicate event severity:
- Debug: verbose output, typically disabled in production
- Info: neutral messages
- Warn: non-critical errors that don't affect the normal operation of the application
- Error: unexpected errors that may require human attention
- Fatal: critical errors resulting in application shutdown
- Timestamp of the event creation. Includes timezone information.
- Arbitrary key-value data with case-sensitive string keys. May be absent in a valid log event.
- The error associated with the log event. May be absent in a valid log event.
Log events are effectively immutable: any changes lead to creation of a new event.
LogEventclass provides a set of special transformation methods:
logEvent = logEvent.WithProperty("Count", 100);
logEvent = logEvent.WithoutProperty("UselessProperty");
This ensures thread safety when routing the same event to multiple logs.