Loading README.rst +18 −8 Original line number Diff line number Diff line Loading @@ -35,14 +35,23 @@ This prints the following JSON to ``stderr`` that, if pretty-printed, looks as f Features -------- - `StructuredLogger <logstruct.StructuredLogger>` - a replacement for `logging.Logger` with a simplified interface for adding structured data to logs. (`Usage <logger_usage>`) - `StructuredFormatter <logstruct.StructuredFormatter>` - a `logging.Formatter` implementation that formats log records as JSON. (`Usage <formatter_usage>`) - `contextual information <context_usage>` to log records with `logstruct.context_scope`. .. Do not use references other than links here, they will not render on PyPI or GitLab. - `StructuredLogger <https://logstruct.readthedocs.io/stable/usage.html#logger-usage>`_ - a replacement for ``logging.Logger`` with a simplified interface for adding structured data to logs. - `StructuredFormatter <https://logstruct.readthedocs.io/stable/usage.html#formatter-configuration>`_ - a ``logging.Formatter`` implementation that formats log records as JSON. - `Contextual information <https://logstruct.readthedocs.io/stable/usage.html#context-variables>`_ added to all log records within ``logstruct.context_scope``. - Easy to use and simple to configure, **no dependencies**. - Seamlessly integrates with any code using stdlib `logging`, e.g. Sentry SDK. - Human readable output for development - see `demo_dev_mode.py <dev_mode_logging>`. - Will work with any tooling that integrates with stdlib ``logging``, e.g. Sentry SDK. - `Human readable output <https://logstruct.readthedocs.io/stable/usage.html#development-mode-logging>`_ for development. Design principles ----------------- Loading Loading @@ -82,7 +91,8 @@ When dependencies are changed, they need to be locked. This will also write requ pdm lock -G :all Tests are run with pytest and Sphinx’s `doctest` target. Tests are run with pytest and Sphinx’s `doctest <https://docs.python.org/3/library/doctest.html#module-doctest>`_ target. .. code:: sh Loading docs/usage.rst +4 −2 Original line number Diff line number Diff line Loading @@ -54,9 +54,10 @@ Once this is done, log records will be output as JSON, regardless of where they .. _logger_usage: .. _logging_structured_data: Structured data --------------- Logging structured data ----------------------- `StructuredLogger <logstruct.StructuredLogger>`'s logging API is nearly identical to the standard library `logging.Logger`. The key difference is that additional **keyword arguments** provided to Loading Loading @@ -283,6 +284,7 @@ docs <https://docs.python.org/3/library/logging.config.html#module-logging.confi the standard library. .. _formatter_usage: .. _formatter_configuration: Formatter configuration ^^^^^^^^^^^^^^^^^^^^^^^ Loading Loading
README.rst +18 −8 Original line number Diff line number Diff line Loading @@ -35,14 +35,23 @@ This prints the following JSON to ``stderr`` that, if pretty-printed, looks as f Features -------- - `StructuredLogger <logstruct.StructuredLogger>` - a replacement for `logging.Logger` with a simplified interface for adding structured data to logs. (`Usage <logger_usage>`) - `StructuredFormatter <logstruct.StructuredFormatter>` - a `logging.Formatter` implementation that formats log records as JSON. (`Usage <formatter_usage>`) - `contextual information <context_usage>` to log records with `logstruct.context_scope`. .. Do not use references other than links here, they will not render on PyPI or GitLab. - `StructuredLogger <https://logstruct.readthedocs.io/stable/usage.html#logger-usage>`_ - a replacement for ``logging.Logger`` with a simplified interface for adding structured data to logs. - `StructuredFormatter <https://logstruct.readthedocs.io/stable/usage.html#formatter-configuration>`_ - a ``logging.Formatter`` implementation that formats log records as JSON. - `Contextual information <https://logstruct.readthedocs.io/stable/usage.html#context-variables>`_ added to all log records within ``logstruct.context_scope``. - Easy to use and simple to configure, **no dependencies**. - Seamlessly integrates with any code using stdlib `logging`, e.g. Sentry SDK. - Human readable output for development - see `demo_dev_mode.py <dev_mode_logging>`. - Will work with any tooling that integrates with stdlib ``logging``, e.g. Sentry SDK. - `Human readable output <https://logstruct.readthedocs.io/stable/usage.html#development-mode-logging>`_ for development. Design principles ----------------- Loading Loading @@ -82,7 +91,8 @@ When dependencies are changed, they need to be locked. This will also write requ pdm lock -G :all Tests are run with pytest and Sphinx’s `doctest` target. Tests are run with pytest and Sphinx’s `doctest <https://docs.python.org/3/library/doctest.html#module-doctest>`_ target. .. code:: sh Loading
docs/usage.rst +4 −2 Original line number Diff line number Diff line Loading @@ -54,9 +54,10 @@ Once this is done, log records will be output as JSON, regardless of where they .. _logger_usage: .. _logging_structured_data: Structured data --------------- Logging structured data ----------------------- `StructuredLogger <logstruct.StructuredLogger>`'s logging API is nearly identical to the standard library `logging.Logger`. The key difference is that additional **keyword arguments** provided to Loading Loading @@ -283,6 +284,7 @@ docs <https://docs.python.org/3/library/logging.config.html#module-logging.confi the standard library. .. _formatter_usage: .. _formatter_configuration: Formatter configuration ^^^^^^^^^^^^^^^^^^^^^^^ Loading