Skip to content
Compare
Choose a tag to compare
@Tastyep Tastyep released this 08 Jan 14:03

Design and extensibility improvements

This release contains a set of improvements based on feedback I received from structlog's users (Thank you again !).
It builds on the previous one to make it more user-friendly and easier to extend. I expect the API to be stable which would pave the way to finally releasing the 1.0 version of structlog !

Additionally, with the release of nvim 0.8, colors are finally displayed when looking at the message's history (:message). This is a good thing for structlog as it will allow defining more colors and improve the overall visual output.

demo

Features

  • Define the pipeline object
    The log modification logic has been moved from the sink to the pipeline object. The pipeline is an encapsulation of log modifiers and a destination sink.
  • Make the logging level configurable at the pipeline level.
    This allows filtering out logs from some pipelines based on logging level. For example, a user might want to log everything to a file, but not create a notification message for each trace log.
  • Provide a sink adapter.
    This adapter allows the user to inject a custom log writer into a sink object. This can be considered as a sink interface using composition instead of inheritance. The NvimNotify sink is now based on this adapter.

Improvements

  • Add a blacklist option to the formatters.
    The blacklist option allows discarding log entries. For instance, this can be used to eliminate the logger_name attribute that is now part of the logger context.
  • More testing and documentation improvements.
    While it is a bit difficult to estimate the coverage due to the lack of solution for computing it, structlog should have a > 90% test coverage.

Bug Fixes

  • Make it possible to create non-asynchronous console sinks.