kups.core.logging
¶
Generic logging interface for simulation frameworks.
CompositeLogger
¶
Combines multiple loggers into one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loggers
|
Logger[State]
|
Loggers to compose. |
()
|
Source code in src/kups/core/logging.py
Logger
¶
Bases: Protocol
Unified logging interface for simulation state.
Implementations control their own filtering (step-based, time-based, etc.).
State extraction must happen synchronously inside log() because JAX
may donate the state buffer immediately after the call returns.
Source code in src/kups/core/logging.py
NullLogger
¶
No-op logger. Useful for warmup or when logging is disabled.
Source code in src/kups/core/logging.py
ProfileLogger
¶
Logger that captures a JAX profiler trace over a range of steps.
Since log(state, step) is called after step step has executed,
the trace is started one step early: the call at start_step - 1
arms the profiler so that start_step through end_step are
captured. When start_step == 0, the trace begins in __enter__.
The resulting trace can be viewed in TensorBoard or Perfetto.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_dir
|
str | Path
|
Directory to write the profiler trace. |
required |
start_step
|
int
|
First step to trace (inclusive). |
required |
end_step
|
int
|
Last step to trace (inclusive). |
required |
Source code in src/kups/core/logging.py
TqdmLogger
¶
Progress bar logger using tqdm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_steps
|
int
|
Total number of steps for the progress bar. |
required |
postfix
|
View[State, dict[str, Any]] | None
|
Optional view extracting a dict from state to display as tqdm postfix. |
None
|