syndisco.logging

Module handling logging for LLM discussion and annotation tasks.

Functions

logging_setup(print_to_terminal, write_to_file)

Create the logger configuration.

timing(f)

Decorator which logs the execution time of a function.

logging_setup(print_to_terminal: bool, write_to_file: bool, logs_dir: str | Path | None = None, level: str = 'debug', use_colors: bool = True, log_warnings: bool = True) None

Create the logger configuration.

Parameters:
  • print_to_terminal (bool) – whether to print logs to the screen

  • write_to_file (bool) – whether to write logs to a file. Needs logs_dir to be specified.

  • logs_dir (Optional[str | Path], optional) – the directory where the logs will be placed, defaults to None

  • level – the logging level, defaults to logging.DEBUG

  • use_colors (bool, defaults to True) – whether to color the output.

  • log_warnings (bool, defaults to True) – whether to log library warnings

timing(f: Callable) Any

Decorator which logs the execution time of a function.

Parameters:

f (Function) – the function to be timed

Returns:

the result of the function

Return type:

_type_