From 67e96cde7f0a7f80a1d962ccd5ef356630a8f2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= Date: Fri, 20 Dec 2024 15:32:46 +0100 Subject: [PATCH] fixes #76 --- docs/conf.py | 10 +++ docs/index.rst | 1 + docs/migration.rst | 22 +++++++ docs/usage.rst | 31 ++-------- seqlog/__init__.py | 35 +++++------ seqlog/feature_flags.py | 77 ----------------------- seqlog/structured_logging.py | 104 ++++++++++---------------------- tests/test_configuration.py | 4 +- tests/test_structured_logger.py | 3 +- 9 files changed, 88 insertions(+), 199 deletions(-) create mode 100644 docs/migration.rst delete mode 100644 seqlog/feature_flags.py diff --git a/docs/conf.py b/docs/conf.py index 6473847..d203694 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,6 +54,16 @@ # The master toctree document. master_doc = 'index' +autodoc_default_options = { + 'members': True, +} +autodoc_default_flags = [ + 'show-inheritance' +] +autodoc_typehints = "description" +autoclass_content = 'both' + + # General information about the project. project = u'SeqLog' copyright = u"2016, Adam Friedman" diff --git a/docs/index.rst b/docs/index.rst index 08a06b9..ca420ae 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,6 +17,7 @@ Contents: readme installation + migration usage usage-gunicorn Modules diff --git a/docs/migration.rst b/docs/migration.rst new file mode 100644 index 0000000..a0af02e --- /dev/null +++ b/docs/migration.rst @@ -0,0 +1,22 @@ +=============================== +Migration guide from 0.4 to 0.5 +=============================== + +First of all, the official way to configure Seq is via + +.. autofunction:: seqlog.configure_from_dict + +Alternatively you can call + +.. autofunction:: seqlog.configure_from_file + + +.. warning:: DO NOT call :code:`logging.config.fromDict` + +Then, FeatureFlags were completely obliterated and moved to SeqLogHandler's constructor. + +Then, the SeqLogHandler accepts way more arguments that you can define in this dict: + +.. autoclass:: seqlog.structured_logging.SeqLogHandler + :members: + diff --git a/docs/usage.rst b/docs/usage.rst index b709a42..c1c73ba 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -58,6 +58,8 @@ First, create your configuration file (e.g. ``/foo/bar/my_config.yml``): # Configure logging from scratch. disable_existing_loggers: True + override_root_logger: True + use_structured_logger: True # Configure the root logger to use Seq root: @@ -98,7 +100,7 @@ First, create your configuration file (e.g. ``/foo/bar/my_config.yml``): seq: style: '{' -Then, call ``seqlog.configure_from_file()``: +Then, call :func:`seqlog.configure_from_file`: .. code-block:: python @@ -115,11 +117,9 @@ Then, call ``seqlog.configure_from_file()``: Configuring logging from a dictionary ------------------------------------- -.. deprecated:: 0.5.0 - Use logging.config.dictConfig() directly - Seqlog can also use a dictionary to describe the desired logging configuration. This dictionary has the schema specified in Python's `logging.config `_ module. +With some extra options described in :func:`seqlog.configure_from_dict`. .. code-block:: python @@ -137,29 +137,6 @@ This dictionary has the schema specified in Python's `logging.config