logging
napt.logging
Console output for NAPT.
Every module writes through the one global logger the CLI configures from
the -v and -d flags. The levels are:
- step: always printed, for the numbered pipeline stages
- info: always printed, for notable events that are not warnings
- warning: always printed and tagged, for something unexpected but recoverable that the user should see
- progress: always printed, overwriting the current line
- verbose: printed with
-v, for implementation detail - debug: printed with
-d(which implies-v), for raw data dumps
Each line starts with a bracketed prefix naming the pipeline stage or the shared domain the message belongs to; the documented set is in CLAUDE.md and a test checks every call against it.
Note
The default global logger is non-verbose: it prints steps, info, warnings, and progress, and hides verbose and debug lines until the CLI installs a configured logger.
Logger
Prints NAPT's console output at the configured verbosity.
Source code in napt/logging.py
debug_enabled
property
Whether debug lines print, so a caller can skip building a dump.
__init__
Sets the verbosity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
If True, print verbose messages. |
False
|
debug
|
bool
|
If True, print debug messages (implies verbose). |
False
|
Source code in napt/logging.py
step
Prints a numbered pipeline stage; always visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
Current step number (1-based). |
required |
total
|
int
|
Total number of steps. |
required |
message
|
str
|
Step description. |
required |
Source code in napt/logging.py
info
Prints a notable event that is not a warning; always visible.
Use for skipping a step for a known reason, replacing an artifact, or a key ID an external system returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Message prefix (e.g., "PACKAGE", "BUILD"). |
required |
message
|
str
|
Informational message. |
required |
Source code in napt/logging.py
warning
Prints something unexpected but recoverable; always visible.
The line carries a WARNING: tag so it stands apart from the
info lines around it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Message prefix (e.g., "DETECTION", "BUILD"). |
required |
message
|
str
|
Warning message. |
required |
Source code in napt/logging.py
progress
Prints download or upload progress, overwriting the current line.
Always visible regardless of verbosity settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Message prefix (e.g., "HTTP", "UPLOAD"). |
required |
message
|
str
|
Progress message (e.g., "42%"). |
required |
Source code in napt/logging.py
verbose
Prints implementation detail; visible with -v.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Message prefix (e.g., "STATE", "BUILD"). |
required |
message
|
str
|
Log message. |
required |
Source code in napt/logging.py
debug
Prints a raw data dump or granular trace; visible with -d.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Message prefix (e.g., "CONFIG", "HTTP"). |
required |
message
|
str
|
Log message. |
required |
Source code in napt/logging.py
get_logger
Builds a logger with the given verbosity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
If True, logger will print verbose messages. |
False
|
debug
|
bool
|
If True, logger will print debug messages (implies verbose). |
False
|
Returns:
| Type | Description |
|---|---|
Logger
|
A logger configured with the specified verbosity. |
Example
Get a verbose logger:
Source code in napt/logging.py
get_global_logger
Returns the logger every module writes through.
Returns:
| Type | Description |
|---|---|
Logger
|
The current global logger instance. |
Note
Until the CLI installs a configured logger, this is the default non-verbose logger: it prints steps, info, warnings, and progress.
Source code in napt/logging.py
set_global_logger
Installs the logger every module writes through.
The CLI calls this once from the parsed -v and -d flags before
running a command; tests install a verbose logger to assert on output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger
|
Logger
|
Logger instance to use as the global logger. |
required |
Example
Configure global logger from CLI: