MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / create_root_logger

Function create_root_logger

app/log.py:12–32  ·  view source on GitHub ↗

Creates a pre-configured root logger. It sets up the logger with custom formatting and attaches the provided handler. Args: handler: The log handler that shall be used (type `logging.Handler`). Returns: A logger object of type `logging.Logger`.

(handler)

Source from the content-addressed store, hash-verified

10
11
12def create_root_logger(handler):
13 """Creates a pre-configured root logger.
14
15 It sets up the logger with custom formatting and attaches the provided
16 handler.
17
18 Args:
19 handler: The log handler that shall be used (type `logging.Handler`).
20
21 Returns:
22 A logger object of type `logging.Logger`.
23 """
24 handler.setFormatter(
25 logging.Formatter(
26 '%(asctime)s.%(msecs)03d %(name)-15s %(levelname)-4s %(message)s',
27 datefmt='%Y-%m-%d %H:%M:%S'))
28
29 root_logger = logging.getLogger()
30 root_logger.addHandler(handler)
31
32 return root_logger
33
34
35# Deriving dynamically via `getLoggerClass()` to ensure that our custom logger

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected