logger
tit.logger ¶
Logging configuration for TI-Toolbox.
setup_logging ¶
setup_logging(level: str = 'INFO') -> None
Configure the tit logger hierarchy.
Sets the log level but adds NO handlers — file handlers are attached
later via add_file_handler() and GUI handlers via Qt signal bridges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
Log level string (DEBUG, INFO, WARNING, ERROR, CRITICAL). Defaults to INFO. |
'INFO'
|
Source code in tit/logger.py
add_file_handler ¶
add_file_handler(log_file: str | Path, level: str = 'DEBUG', logger_name: str = 'tit') -> FileHandler
Attach a file handler to a named logger.
Creates the parent directory if it does not exist. Returns the handler so callers can remove it when the run completes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_file
|
str | Path
|
Path to the log file (opened in append mode). |
required |
level
|
str
|
Minimum log level for this handler. Defaults to DEBUG so the file captures everything. |
'DEBUG'
|
logger_name
|
str
|
Logger to attach to. Defaults to the root "tit" logger. |
'tit'
|
Returns:
| Type | Description |
|---|---|
FileHandler
|
The created FileHandler instance. |
Source code in tit/logger.py
add_stream_handler ¶
add_stream_handler(logger_name: str = 'tit', level: str = 'INFO') -> StreamHandler
Attach a stdout handler to a named logger.
Used by scripts for terminal output and by __main__ entry points
so that BaseProcessThread can capture subprocess stdout for the GUI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger_name
|
str
|
Logger to attach to. Defaults to |
'tit'
|
level
|
str
|
Minimum log level. Defaults to INFO. |
'INFO'
|
Returns:
| Type | Description |
|---|---|
StreamHandler
|
The created StreamHandler instance. |
Source code in tit/logger.py
get_file_only_logger ¶
Return a logger that writes ONLY to log_file — no console output.
If a logger with name already exists its handlers are replaced so that repeated calls (e.g. across ROIs) always point at the correct file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Logger name (should be unique per use-case). |
required |
log_file
|
str | Path
|
Path to the log file. |
required |
level
|
str
|
Minimum log level. Defaults to DEBUG. |
'DEBUG'
|
Returns:
| Type | Description |
|---|---|
Logger
|
A configured :class: |