tit
tit ¶
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_path_manager ¶
get_path_manager(project_dir: str | None = None) -> PathManager
Return the global PathManager singleton.
Source code in tit/paths.py
init ¶
init(level: str = 'INFO') -> None
One-call setup for scripts: configure logging and enable terminal output.
Equivalent to::
setup_logging(level)
add_stream_handler("tit", level)
Call this at the top of any script that uses the tit package
to get sensible defaults with no extra boilerplate.