Skip to content

Commit e5fa29b

Browse files
committed
initial
1 parent c6e4cc1 commit e5fa29b

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

packages/service-library/src/servicelib/logging_utils.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,18 @@ def config_all_loggers(
214214
logger_filter_mapping: Mapping of logger names to filtered message substrings
215215
tracing_settings: OpenTelemetry tracing configuration
216216
"""
217-
the_manager: logging.Manager = logging.Logger.manager
218-
root_logger = logging.getLogger()
219-
loggers = [root_logger] + [
220-
logging.getLogger(name) for name in the_manager.loggerDict
221-
]
222-
223217
# Create format string
224218
fmt = _setup_format_string(
225219
tracing_settings=tracing_settings,
226220
log_format_local_dev_enabled=log_format_local_dev_enabled,
227221
)
228222

223+
the_manager: logging.Manager = logging.Logger.manager
224+
root_logger = logging.getLogger()
225+
loggers = [root_logger] + [
226+
logging.getLogger(name) for name in the_manager.loggerDict
227+
]
228+
229229
# Apply handlers to loggers
230230
for logger in loggers:
231231
_set_logging_handler(
@@ -241,9 +241,9 @@ def config_all_loggers(
241241
@asynccontextmanager
242242
async def setup_async_loggers(
243243
*,
244-
log_format_local_dev_enabled: bool = False,
245-
logger_filter_mapping: dict[LoggerName, list[MessageSubstring]] | None = None,
246-
tracing_settings: TracingSettings | None = None,
244+
log_format_local_dev_enabled: bool,
245+
logger_filter_mapping: dict[LoggerName, list[MessageSubstring]],
246+
tracing_settings: TracingSettings | None,
247247
) -> AsyncGenerator[None, None]:
248248
"""
249249
Async context manager for non-blocking logging infrastructure.
@@ -273,12 +273,7 @@ async def setup_async_loggers(
273273
if logger_filter_mapping:
274274
_apply_logger_filters(logger_filter_mapping)
275275

276-
_logger.info("Async logging setup completed")
277-
278-
try:
279-
yield
280-
finally:
281-
_logger.debug("Async logging context exiting")
276+
yield
282277

283278

284279
class LogExceptionsKwargsDict(TypedDict, total=True):

packages/service-library/tests/test_logging_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ async def test_setup_async_loggers_basic(
436436

437437
# Check that the log message was captured
438438
assert "Test async log message" in caplog.text
439-
assert "Async logging setup completed" in caplog.text
440439

441440

442441
async def test_setup_async_loggers_with_filters(

0 commit comments

Comments
 (0)