Skip to content

Commit 796bb0e

Browse files
committed
added docs
1 parent 318aba2 commit 796bb0e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

β€Žpackages/service-library/src/servicelib/logging_utils.pyβ€Ž

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,38 @@ def setup_loggers(
222222
"""
223223
Applies comprehensive configuration to ALL registered loggers.
224224
225+
Flow Diagram (Synchronous Logging):
226+
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
227+
β”‚ Application β”‚ β”‚ Root Logger β”‚
228+
β”‚ Thread │───────────────────▢│ StreamHandler β”‚
229+
β”‚ β”‚ β”‚ β”œβ”€ Formatter β”‚
230+
β”‚ logger.info() β”‚ β”‚ └─ Output β”‚
231+
β”‚ logger.error() β”‚ β”‚ β”‚
232+
β”‚ (blocking I/O) β”‚ β”‚ β”‚
233+
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
234+
β”‚ β”‚
235+
β”‚ β–Ό
236+
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
237+
β”‚ β”‚ Console/ β”‚
238+
β”‚ β”‚ Terminal β”‚
239+
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
240+
β”‚
241+
└─ Blocks until I/O completes
242+
225243
This function uses a comprehensive approach:
226244
- Removes all handlers from all loggers
227245
- Ensures all loggers propagate to root
228246
- Sets up root logger with properly formatted handler
247+
- All logging calls are synchronous and may block on I/O
248+
249+
For async/non-blocking logging, use `async_loggers` context manager instead.
229250
230251
Args:
231252
log_format_local_dev_enabled: Enable local development formatting
232253
logger_filter_mapping: Mapping of logger names to filtered message substrings
233254
tracing_settings: OpenTelemetry tracing configuration
255+
log_base_level: Base logging level to set
256+
noisy_loggers: Loggers to set to a quieter level
234257
"""
235258
_setup_base_logging_level(log_base_level)
236259
if noisy_loggers is not None:

0 commit comments

Comments
Β (0)