File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,21 @@ call :meth:`~google.cloud.logging_v2.client.Client.setup_logging` on a :class:`~
1616 :end-before: [END logging_handler_setup]
1717 :dedent: 4
1818
19+
20+ You can also set the logging level threshold of the logging handler created by :meth: `~google.cloud.logging_v2.client.Client.setup_logging `,
21+ as well as set loggers excluded from the logger that is created:
22+
23+ .. literalinclude :: ../samples/snippets/usage_guide.py
24+ :start-after: [START logging_setup_logging]
25+ :end-before: [END logging_setup_logging]
26+ :dedent: 4
27+
28+ .. literalinclude :: ../samples/snippets/usage_guide.py
29+ :start-after: [START logging_setup_logging_excludes]
30+ :end-before: [END logging_setup_logging_excludes]
31+ :dedent: 4
32+
33+
1934This :meth: `~google.cloud.logging_v2.client.Client.setup_logging ` function chooses the best configurations for the environment your
2035code is running on. For more information, see the `Google Cloud Logging documentation <https://cloud.google.com/logging/docs/setup/python >`_.
2136
Original file line number Diff line number Diff line change @@ -400,7 +400,8 @@ def setup_logging(
400400 loggers, will report to Cloud Logging.
401401
402402 Args:
403- log_level (Optional[int]): Python logging log level. Defaults to
403+ log_level (Optional[int]): The logging level threshold of the attached logger,
404+ as set by the :meth:`logging.Logger.setLevel` method. Defaults to
404405 :const:`logging.INFO`.
405406 excluded_loggers (Optional[Tuple[str]]): The loggers to not attach the
406407 handler to. This will always include the
Original file line number Diff line number Diff line change @@ -296,7 +296,8 @@ def setup_logging(
296296 excluded_loggers (Optional[Tuple[str]]): The loggers to not attach the handler
297297 to. This will always include the loggers in the
298298 path of the logging client itself.
299- log_level (Optional[int]): Python logging log level. Defaults to
299+ log_level (Optional[int]): The logging level threshold of the attached logger,
300+ as set by the :meth:`logging.Logger.setLevel` method. Defaults to
300301 :const:`logging.INFO`.
301302 """
302303 all_excluded_loggers = set (excluded_loggers + _INTERNAL_LOGGERS )
Original file line number Diff line number Diff line change @@ -475,13 +475,13 @@ def using_extras(client):
475475def setup_logging (client ):
476476 import logging
477477
478- # [START setup_logging ]
478+ # [START logging_setup_logging ]
479479 client .setup_logging (log_level = logging .INFO )
480- # [END setup_logging ]
480+ # [END logging_setup_logging ]
481481
482- # [START setup_logging_excludes ]
482+ # [START logging_setup_logging_excludes ]
483483 client .setup_logging (log_level = logging .INFO , excluded_loggers = ("werkzeug" ,))
484- # [END setup_logging_excludes ]
484+ # [END logging_setup_logging_excludes ]
485485
486486
487487@snippet
You can’t perform that action at this time.
0 commit comments