π‘ unaiverse.networking.p2p.mylogger
What this module does π‘
Logging utility configuring a per-module timed-rotating file logger for the P2P networking layer.
mylogger
¶
βββββ βββββ ββββββ βββββ βββββ βββββ βββββ ββββββββββ βββββββββββ βββββββββ ββββββββββ
βββββ βββββ ββββββββ βββββ βββββ βββββ βββββ ββββββββββββββββββββββββ ββββββββββββββββββββββ
ββββ ββββ ββββββββ ββββ ββββββ ββββ ββββ ββββ ββββ β β ββββ ββββ ββββ βββ ββββ β β
ββββ ββββ βββββββββββββ ββββββββ ββββ ββββ ββββ βββββββ βββββββββββ βββββββββββ βββββββ
ββββ ββββ ββββ ββββββββ βββββββ ββββ βββββ βββ βββββββ ββββββββββββ βββββββββββ βββββββ
ββββ ββββ ββββ βββββββ ββββββββ ββββ βββββββββ ββββ β β ββββ ββββ βββ ββββ ββββ β β
ββββββββββ βββββ βββββββββββββββββ βββββ βββββ ββββββββββ βββββ ββββββββββββββββ ββββββββββ
ββββββββ βββββ βββββ ββββββββ βββββ βββ ββββββββββ βββββ βββββ βββββββββ ββββββββββ
A Collectionless AI Project (https://collectionless.ai)
Registration/Login: https://unaiverse.io
Code Repositories: https://github.com/collectionlessai/
Main Developers: Stefano Melacci (Project Leader), Christian Di Maio, Tommaso Guidi
setup_logger
¶
Return a configured logging.Logger for the given module name.
Creates or retrieves the logging.Logger identified by module_name and
attaches a TimedRotatingFileHandler that writes UTF-8 log records under
LOG_FOLDER. The log file is named <module_name>.log and rotated at the
interval specified by when. Up to backup_count rotated files are retained
before the oldest is deleted.
Log records use the format::
YYYY-MM-DD HH:MM:SS [LEVEL] filename:lineno - message
with UTC timestamps. Propagation to the root logger is disabled so that records from this logger do not appear twice when a root handler is configured.
Note
The internal do_log flag is currently hardcoded to False. When it is
False, any existing handlers are cleared and a NullHandler is attached
instead, so no file I/O occurs and LOG_FOLDER is never created. This
behaviour is intentional for production use; enabling file logging requires
setting do_log = True in the source.
If the logger for module_name already has handlers attached (i.e., it was
previously configured), no duplicate handler is added.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name
|
str
|
The name used to identify the logger and to derive the log file
name ( |
required |
when
|
str
|
Rotation interval passed directly to |
'midnight'
|
backup_count
|
int
|
Number of rotated log files to keep before the oldest is
deleted. Defaults to |
7
|
Returns:
| Type | Description |
|---|---|
Logger
|
A |
Logger
|
a |
Logger
|
|