IasLogging.log
index
/scratch/home/acaproni/IasRoot/lib/python3.12/site-packages/IasLogging/log.py

 
Modules
       
argparse
datetime
logging
email.parser

 
Classes
       
builtins.object
Log

 
class Log(builtins.object)
    Log provides common initialization for all python logging in IAS environment. 
It defines a file handler and a console handler, with the different format and levels.
 
The log file is created in the logs folder with the name of the script and the date and time of the execution. 
To get a logger, use standard logging.getLogger().
 
  Class methods defined here:
add_log_arguments_to_parser(parser: argparse.ArgumentParser) -> None
Add the log arguments to an argparse parser.
 
This function is meant to ease the addition of log arguments to all the scripts in IAS environment,
to have a consistent way to configure logging.
 
:param parser: The argparse parser to which add the log arguments.
get_log_file() -> pathlib.Path
Return the log file path
 
Raise an exception if the log has not yet been initialized
get_log_folder() -> pathlib.Path
Return the folder where the log file is stored
 
Raise an exception if the log has not yet been initialized
init_log_from_cmdline_args(args: argparse.Namespace, name_file: str) -> None
Initialize the logging from the command line arguments.
 
The arguments in the command line must be proveded as defined by :meth:`~Log.add_log_arguments_to_parser`.
 
This function is meant to ease the initialization of logging from command line arguments in all the scripts in IAS environment,
to have a consistent way to configure logging.
 
init_log_from_cmdline_args delegates to :meth:`~Log.init_logging`.
 
:param args: The command line arguments as parsed by argparse.
:param name_file: The name of the log file with or without .log extension.
init_logging(name_file, file_level_name='info', console_level_name='info') -> None
Initialize the logging for IAS environment.
 
To get a logger, use getLogger()
is_initialized() -> bool
Check if the logging has been initialized.
 
:return: True if the logging has been initialized, False otherwise.

Static methods defined here:
get_level(level_name: str) -> int
Get the logging level from its name

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

Data and other attributes defined here:
__annotations__ = {'_log_file': pathlib.Path | None, '_log_folder': pathlib.Path | None, '_root_logger': logging.Logger | None}

 
Functions
       
Lock = allocate_lock(...)
allocate_lock() -> lock object
(allocate() is an obsolete synonym)
 
Create a new lock object. See help(type(threading.Lock())) for
information about locks.