Structured Logging (Semantic Logging) in Python and C#

Why Structured logging:

1. machine parseable logs:

When a log is automatically parseable, this enables viewing, searching and filtering.

A parseable log can also enable further processing or display (for example: command line tools that output parseable logs are easier to automate via another tool such as a desktop app with graphical user interface).

2. logged events have context

Adding more context to each log event helps later debugging. Why: when programming, it can be difficult to know what info to add that would help future debugging.

Also see: the 'why' of Python's structlog.

Structured logging in C#:

serilog

serilog on github


Further reading - C#

- Logging in .NET Core and ASP.NET Core

Structured Logging and Logs Management. A case study using ASP.NET Core, Serilog & Seq



Structured logging in Python:

structlog - Structured Logging for Python

Comments