A few months ago, a proposal was introduced for adding a structured logging library in Go. At present, Go has a minimal and bare-bones log package which works all right for basic use cases. However, the current library has a few shortcomings that this proposal aims to solve:
- Emitting logs with different severity/levels
- Structured output: Makes parsing of logs harder
- Logging a set of common fields/attributes
- Difficult to have a log object inside libraries as each service could have its log implementation.
Source: Structured logging in Go with slog, an article by Karan Sharma.