qten.utils.loggings
Module reference for qten.utils.loggings.
loggings
Logging helpers for QTen internals.
This module keeps logger creation consistent across the package by installing a small stream formatter the first time a named logger is requested.
get_logger
get_logger(
name: str, show_datetime: bool = False
) -> logging.Logger
Return a configured logger for this package.
Creates or reuses a named logger and, on first use for that logger,
attaches a StreamHandler with a fixed format of:
[{name}|{level}] {message} or, when requested,
[{datetime}|{name}|{level}] {message}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Logger name, typically |
required |
show_datetime
|
bool
|
Whether to include |
False
|
Returns:
| Type | Description |
|---|---|
Logger
|
A logger instance configured with the package formatter. |
Examples:
logger = get_logger(__name__, show_datetime=True)
logger.debug("message")
Source code in src/qten/utils/loggings.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |