RFL: log package
Logging utility.
setup_logger()
Configure the root logger with one or two stream handlers, a formatter, and per-component filtering.
Basic usage
import logging
from rfl.log import setup_logger
setup_logger() # INFO level (default)
setup_logger(debug=True) # DEBUG level
setup_logger(level=logging.WARNING) # WARNING and above
setup_logger(level="ERROR") # string level names also accepted
Log level
Level is resolved in this order:
levelargument (int constant or string name:DEBUG,INFO,WARNING,ERROR,CRITICAL)debug=True→DEBUG(whenlevelis omitted)- default →
INFO
The debug flag also controls formatter verbosity (detailed prefixes), independent
of the resolved log level.
Component filtering
By default, only log records from components listed in log_flags are shown for
INFO and above. DEBUG records require debug_flags.
setup_logger(log_flags=["rfl"]) # INFO+ from rfl only
setup_logger(debug=True, debug_flags=["network"]) # DEBUG from network only
setup_logger(log_flags=["ALL"], debug_flags=["ALL"]) # show everything
Component names are derived from the first segment of the logger name
(e.g. rfl.pkg.module → rfl).
Streams
By default, one handler writes every accepted record to stderr. Pass stream
to send that single handler somewhere else. Every accepted level still goes to
that stream.
import sys
setup_logger(stream=sys.stdout) # single handler on stdout
setup_logger(error_stream=sys.stderr) # below WARNING → stdout, WARNING+ → stderr
When error_stream is set, records below WARNING go to stream (sys.stdout
when stream is omitted) and WARNING and above go to error_stream. The error
handler level is at least WARNING, and at least the configured level, so a
level of ERROR still suppresses WARNING. Both handlers share the formatter and
the component filters.
Other options
component: prefix log lines with a fixed component label in the formatterformatter: formatter class factory (default: TTY or daemon auto-selection)clear: whenTrue(default), remove existing root handlers before setup; setclear=Falseto stack handlers
component_flag_filter()
Build the same component allow-list used by setup_logger() and
enforce_debug(), and attach it to a handler those functions do not create
(an OTLP bridge, an extra stream, and so on).
import logging
from rfl.log import component_flag_filter
handler = logging.StreamHandler()
handler.addFilter(component_flag_filter(log_flags=["rfl"], debug_flags=["rfl"]))
logging.getLogger().addHandler(handler)
log_flags selects components for INFO and above. debug_flags selects
components for DEBUG only. "ALL" matches every component. Omit either list
(or pass None) to drop records at that level. The component is the first
segment of the logger name (rfl.pkg.module → rfl). The filter returns 1
to keep a record and 0 to drop it.
Metadata
Release files for RFL.log 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rfl_log-1.10.0.tar.gz | 7.9 kB | Without provenance | Details for rfl_log-1.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rfl_log-1.10.0-py3-none-any.whl | Python 3 | none | any | Details for rfl_log-1.10.0-py3-none-any.whl |
Total release size: 16.7 kB
Release files / rfl_log-1.10.0.tar.gz
| Download URL | rfl_log-1.10.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
729a533b1e3b78c356ac9236c22499cd1a4f0754afb88ed4ac22fde55e317372
|
|
BLAKE2b-256 checksum How to use checksums |
4a1f9c0860de8a661e9e229b12febed474361b76e4d10da1eb6ccb3c37d2199a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / rfl_log-1.10.0-py3-none-any.whl
| Download URL | rfl_log-1.10.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cafe5fb066ce6e499612776d4c4a31450cca9a6ae7add6f1b3382a1708fc98dd
|
|
BLAKE2b-256 checksum How to use checksums |
78eed13a6109574179339046ef7be0b70e0dbc6aac7012ed756cf63f35950c55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for RFL.log 1.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.