π΄ unaiverse.utils.logger
What this module does π΄
Custom logging framework providing colored output (Ch), a feature-rich internal logger
(_Logger) with custom severity levels, and the public Logger facade exposed project-wide
as log.
logger
¶
βββββ βββββ ββββββ βββββ βββββ βββββ βββββ ββββββββββ βββββββββββ βββββββββ ββββββββββ βββββ βββββ ββββββββ βββββ βββββ βββββ βββββ ββββββββββββββββββββββββ ββββββββββββββββββββββ ββββ ββββ ββββββββ ββββ ββββββ ββββ ββββ ββββ ββββ β β ββββ ββββ ββββ βββ ββββ β β ββββ ββββ βββββββββββββ ββββββββ ββββ ββββ ββββ βββββββ βββββββββββ βββββββββββ βββββββ ββββ ββββ ββββ ββββββββ βββββββ ββββ βββββ βββ βββββββ ββββββββββββ βββββββββββ βββββββ ββββ ββββ ββββ βββββββ ββββββββ ββββ βββββββββ ββββ β β ββββ ββββ βββ ββββ ββββ β β ββββββββββ βββββ βββββββββββββββββ βββββ βββββ ββββββββββ βββββ ββββββββββββββββ ββββββββββ ββββββββ βββββ βββββ ββββββββ βββββ βββ ββββββββββ βββββ βββββ βββββββββ ββββββββββ 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
ALWAYS_ON_CHANNELS
module-attribute
¶
EXTRA_CHANNELS
module-attribute
¶
EXTRA_CHANNELS: frozenset[Ch] = frozenset({NETWORK, STREAMS, INTER, MISC, DEBUG, STATEM, CPOOL, P2P})
ALL_CHANNELS
module-attribute
¶
ALL_CHANNELS: frozenset[Ch] = frozenset(ALWAYS_ON_CHANNELS | EXTRA_CHANNELS)
Ch
¶
Bases: str, Enum
Enumeration of independent, non-hierarchical log output channels.
Each channel represents a distinct concern of the application, not a
severity tier. Every channel can be individually enabled or disabled for
screen output and for file persistence at runtime via _Logger.enable,
_Logger.disable, _Logger.enable_screen, and
_Logger.disable_screen.
CRITICAL, ERROR, and USER are always-on channels: they cannot
be suppressed by disable or disable_screen. All other channels
are optional and can be toggled freely.
Channel descriptions:
CRITICAL- Fatal conditions. Always written to file and screen. Calling_Logger.criticalalso raises aGenException.ERROR- Non-fatal errors and warnings.USER- Output intended for the end user (human-readable app output).STATEM- Per-clock-cycle full app state snapshots.NETWORK- Networking events: connections, disconnections, message routing.STREAMS- Stream-level data-flow events: tokens, buffers, lifecycle.INTER- Inter-node / cross-instance communication events (RPCs, coordination).MISC- Miscellaneous / uncategorized internal output.DEBUG- Fine-grained developer diagnostics; off by default.CPOOL- Connection pool lifecycle events (slots, eviction, limits).P2P- Raw output captured from the underlying Go libp2p library (stdout/stderr).
Subdomain tag (sub= kwarg, available on every channel):
Every channel supports an optional sub= tag to identify which
subdomain the record belongs to. The three standard values are:
"pub"- public network side"prv"- private network side"gen"- generic / not subdomain specific (default when omitted)
Pass sub= explicitly to override the sticky tag set via set_sub::
log.network("peer connected", sub="pub", peer=pid)
log.network("relay heartbeat", sub="prv", relay=rid)
log.streams("token received", sub="pub", tokens=12)
log.statem("state snapshot", sub="prv", mode="IDLE")
log.debug("internal trace", sub="prv")
log.misc("startup", sub="gen") # same as omitting sub=
The tag is stored as a top-level "sub" field in every JSON record
(parallel to "ch", not inside "info"). When sub= is omitted
the sticky value set by set_sub is used; if that is also unset the
record gets "sub": "gen" automatically.