Logging API¶
Logging utilities and configuration.
Logging Utilities¶
Utilities for configuring PARE logging.
PAREFormatter
¶
Bases: ScenarioAwareFormatter
Formatter with optional color support for file and console handlers.
Source code in pare/logging_config.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
__init__(use_colors=True)
¶
Initialize formatter.
Source code in pare/logging_config.py
20 21 22 23 | |
format(record)
¶
Format the record with Scenario ID and optionally color support.
Source code in pare/logging_config.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
configure_logging(level=logging.INFO, use_tqdm=False, log_dir=None, scenario_id=None, run_number=None)
¶
Configure logging for PARE application.
This configures the root logger, which all other loggers propogate to. Uses ARE's formatter and handler for consistent formatting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
The logging level (default: logging.INFO) |
INFO
|
use_tqdm
|
bool
|
Whether to use tqdm-compatible logging (for progress bars) |
False
|
log_dir
|
Path | None
|
The directory to log to (default: None) |
None
|
scenario_id
|
str | None
|
The scenario ID to log to (default: None) |
None
|
run_number
|
int | None
|
The run number to log to (default: None) |
None
|
Source code in pare/logging_config.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
suppress_noisy_are_loggers()
¶
Suppress noisy loggers from the ARE simulation module.
Source code in pare/logging_config.py
146 147 148 149 150 151 152 153 154 155 156 157 | |
suppress_noisy_loggers()
¶
Suppress noisy loggers from third-party libraries and ARE simulation module.
Source code in pare/logging_config.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |