Display TTY  1
Customise your terminal's output
Loading...
Searching...
No Matches
display_tty.src.initialiser Namespace Reference

Functions

Disp initialise_logger (Union[Logging, str] class_name, bool debug=False, *, Optional[Dict[str, Any]] toml_content=None, Optional[bool] save_to_file=None, Optional[str] file_name=None, Optional[Any] file_descriptor=None, Optional[int] success=None, Optional[int] error=None, Optional[bool] log_warning_when_present=None, Optional[bool] log_errors_when_present=None)
 

Detailed Description

# +==== BEGIN display_tty =================+
# LOGO: 
# ..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# .@...........................#@
# @############################.@
# @...........................@.@
# @..#######################..@.@
# @.#########################.@.@
# @.##>_#####################.@.@
# @.#########################.@.@
# @.#########################.@.@
# @.#########################.@.@
# @.#########################.@.@
# @..#######################..@.@
# @...........................@.@
# @..+----+______________.....@.@
# @..+....+______________+....@.@
# @..+----+...................@.@
# @...........................@.#
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@#.
# /STOP
# PROJECT: display_tty
# FILE: initialiser.py
# CREATION DATE: 06-11-2025
# LAST Modified: 12:28:7 06-11-2025
# DESCRIPTION: 
# A module that allows you to display text with a few boilers (i.e. put your text in a square for titles). It also allows to log to the terminal by wrapping around the logging library.
# /STOP
# COPYRIGHT: (c) Henry Letellier
# PURPOSE: File in charge of containing a helper function that will initialising the disp class with the user provided arguments.
# // AR
# +==== END display_tty =================+

Function Documentation

◆ initialise_logger()

Disp display_tty.src.initialiser.initialise_logger ( Union[Logging, str] class_name,
bool debug = False,
* ,
Optional[Dict[str, Any]] toml_content = None,
Optional[bool] save_to_file = None,
Optional[str] file_name = None,
Optional[Any] file_descriptor = None,
Optional[int] success = None,
Optional[int] error = None,
Optional[bool] log_warning_when_present = None,
Optional[bool] log_errors_when_present = None )
@brief Initialise and return a configured Disp instance for a given class or module.

This factory function creates and returns a configured `Disp` instance (the library's
display/logger wrapper) using defaults from `TOML_CONF`, `SAVE_TO_FILE` and `FILE_NAME`
unless overridden by the provided keyword arguments. The `class_name` may be a
`Logging`-compatible object (an object exposing logging-like methods) or a simple string
used as a label for the logger.

@param class_name Union[Logging, str]
    The logging owner (class instance or name) to attach to the returned `Disp` instance.
@param debug bool, optional
    If True the returned `Disp` instance will run in debug mode (enable debug-level output).
    Defaults to False.
@param toml_content Optional[Dict[str, Any]]
    Optional override for TOML configuration content (defaults to module-level TOML_CONF).
@param save_to_file Optional[bool]
    Optional override to enable saving output to a file (defaults to module-level SAVE_TO_FILE).
@param file_name Optional[str]
    Optional override for the file name used when saving to file (defaults to FILE_NAME).
@param file_descriptor Optional[Any]
    Optional open file-like object to use for output (will be passed to `Disp`).
@param success Optional[int]
    Optional custom success return code for the `Disp` instance.
@param error Optional[int]
    Optional custom error return code for the `Disp` instance.
@param log_warning_when_present Optional[bool]
    Optional flag to control whether warnings are logged when present.
@param log_errors_when_present Optional[bool]
    Optional flag to control whether errors are logged when present.

@return Disp
    A configured `Disp` instance ready to use.

@note
    - Optional arguments are only applied when provided (truthy) except `save_to_file` which is explicitly converted to bool when passed.
    - Use `file_descriptor` to reuse an open file handle instead of letting `Disp` open its own file.
    - This function updates only configuration passed to `Disp` and does not change library global constants.

Definition at line 40 of file initialiser.py.