Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Added documentation for Django/Flask integrations and dictConfig #848

Merged
merged 7 commits into from
Feb 14, 2024
Prev Previous commit
Next Next commit
Added product prefix to new snippet
  • Loading branch information
gkevinzheng committed Feb 12, 2024
commit 82432f674db038a7768a221398c89c0b2b9f74cd
4 changes: 2 additions & 2 deletions docs/std-lib-integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ There are two supported handler classes to choose from:
Handler classes can also be specified via `dictConfig <https://docs.python.org/3/library/logging.config.html#logging-config-dictschema>`_:

.. literalinclude:: ../samples/snippets/usage_guide.py
:start-after: [START dict_config]
:end-before: [END dict_config]
:start-after: [START logging_dict_config]
:end-before: [END logging_dict_config]
:dedent: 4

Note that since :class:`~google.cloud.logging_v2.handlers.handlers.CloudLoggingHandler` requires an already initialized :class:`~google.cloud.logging_v2.client.Client`,
Expand Down
6 changes: 3 additions & 3 deletions samples/snippets/usage_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,10 @@ def setup_logging(client):


@snippet
def dict_config(client):
def logging_dict_config(client):
import logging.config

# [START dict_config]
# [START logging_dict_config]
LOGGING = {
"version": 1,
"handlers": {
Expand All @@ -506,7 +506,7 @@ def dict_config(client):
"my_other_logger": {"handlers": ["structured_log"], "level": "INFO"},
},
}
# [END dict_config]
# [END logging_dict_config]

logging.config.dictConfig(LOGGING)

Expand Down