Terarea  2
The automation project
Loading...
Searching...
No Matches
src.lib.actions.logger.ActionLogger Class Reference
Collaboration diagram for src.lib.actions.logger.ActionLogger:
Collaboration graph

Public Member Functions

None __init__ (self, RuntimeData runtime_data, int success=0, int error=84, bool debug=False)
 
int log_event (self, str log_type, int action_id=0, int code=ACONST.CODE_ERROR, Union[str, None] message=None, bool resolved=False)
 
int log_info (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_success (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_debug (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_warning (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_error (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_critical (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_fatal (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
int log_unknown (self, str log_type, int action_id=0, Union[str, None] message=None, bool resolved=False)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs (self, Union[int, None] action_id=None, Union[int, None] code=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_unknown (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_info (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_success (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_debug (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_warning (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_error (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_critical (self, Union[int, None] action_id=None, bool beautify=True)
 
Union[List[Union[Dict[str, Any], List[Any]]], int] get_logs_fatal (self, Union[int, None] action_id=None, bool beautify=True)
 

Data Fields

 error = error
 
 debug = debug
 
 success = success
 
 runtime_data = runtime_data
 
Disp disp
 

Protected Member Functions

bool _check_if_action_id_in_table (self, int action_id=0)
 

Detailed Description

_summary_
    Class in charge of logging events into the logging database

Definition at line 14 of file logger.py.

Constructor & Destructor Documentation

◆ __init__()

None src.lib.actions.logger.ActionLogger.__init__ ( self,
RuntimeData runtime_data,
int success = 0,
int error = 84,
bool debug = False )
_summary_
    Class in charge of logging events into the logging database

Args:
    runtime_data (RuntimeData): _description_
    success (int, optional): _description_. Defaults to 0.
    error (int, optional): _description_. Defaults to 84.
    debug (bool, optional): _description_. Defaults to False.

Definition at line 19 of file logger.py.

Member Function Documentation

◆ _check_if_action_id_in_table()

bool src.lib.actions.logger.ActionLogger._check_if_action_id_in_table ( self,
int action_id = 0 )
protected
_summary_
    Check if the action_id is in the Actions table

Args:
    action_id (int, optional): _description_. Defaults to 0.: The id of the concerned action.

Returns:
    bool: _description_: Returns True if it is present, False otherwise.

Definition at line 126 of file logger.py.

◆ get_logs()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs ( self,
Union[int, None] action_id = None,
Union[int, None] code = None,
bool beautify = True )
_summary_
    Get the logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    code (Union[int, None], optional): _description_: Specify a code to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 320 of file logger.py.

◆ get_logs_critical()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_critical ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the critical logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 455 of file logger.py.

◆ get_logs_debug()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_debug ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the debug logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 404 of file logger.py.

◆ get_logs_error()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_error ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the error logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 438 of file logger.py.

◆ get_logs_fatal()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_fatal ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the fatal logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 472 of file logger.py.

◆ get_logs_info()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_info ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the info logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 370 of file logger.py.

◆ get_logs_success()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_success ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the success logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 387 of file logger.py.

◆ get_logs_unknown()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_unknown ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the unknown logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 353 of file logger.py.

◆ get_logs_warning()

Union[List[Union[Dict[str, Any], List[Any]]], int] src.lib.actions.logger.ActionLogger.get_logs_warning ( self,
Union[int, None] action_id = None,
bool beautify = True )
_summary_
    Get the warning logs from the database

Args:
    action_id (Union[int, None], optional): _description_: Specify an action id to narrow down the results.
    beautify (bool, optional): _description_: Set to True if you wish to beautify the output

Returns:
    Union[List[Dict[str, Any]], int]: _description_: Returns the logs if it succeeds, self.error otherwise

Definition at line 421 of file logger.py.

◆ log_critical()

int src.lib.actions.logger.ActionLogger.log_critical ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an critical event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 257 of file logger.py.

◆ log_debug()

int src.lib.actions.logger.ActionLogger.log_debug ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an debug event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 194 of file logger.py.

◆ log_error()

int src.lib.actions.logger.ActionLogger.log_error ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an error event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 236 of file logger.py.

◆ log_event()

int src.lib.actions.logger.ActionLogger.log_event ( self,
str log_type,
int action_id = 0,
int code = ACONST.CODE_ERROR,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    code (int, optional): _description_: The code of the event, defaults to ACONST.CODE_ERROR
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns 0 if it succeeds, 84 otherwise

Definition at line 44 of file logger.py.

◆ log_fatal()

int src.lib.actions.logger.ActionLogger.log_fatal ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an fatal event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 278 of file logger.py.

◆ log_info()

int src.lib.actions.logger.ActionLogger.log_info ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an info event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 152 of file logger.py.

◆ log_success()

int src.lib.actions.logger.ActionLogger.log_success ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an success event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 173 of file logger.py.

◆ log_unknown()

int src.lib.actions.logger.ActionLogger.log_unknown ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an unknown event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 299 of file logger.py.

◆ log_warning()

int src.lib.actions.logger.ActionLogger.log_warning ( self,
str log_type,
int action_id = 0,
Union[str, None] message = None,
bool resolved = False )
_summary_
    Log an warning event into the logging database

Args:
    log_type (str): _description_: The type of the event
    action_id (int, optional): _description_: The id of the action that triggered the event, defaults to 0
    message (Union[str, None], optional): _description_: The message of the event, defaults to None
    resolved (bool, optional): _description_: The status of the event, defaults to False

Returns:
    int: _description_: Returns self.success if it succeeds, self.error otherwise

Definition at line 215 of file logger.py.

Field Documentation

◆ debug

src.lib.actions.logger.ActionLogger.debug = debug

Definition at line 31 of file logger.py.

◆ disp

Disp src.lib.actions.logger.ActionLogger.disp
Initial value:
= Disp(
TOML_CONF,
SAVE_TO_FILE,
FILE_NAME,
FILE_DESCRIPTOR,
debug=self.debug,
logger=self.__class__.__name__
)

Definition at line 35 of file logger.py.

◆ error

src.lib.actions.logger.ActionLogger.error = error

Definition at line 30 of file logger.py.

◆ runtime_data

src.lib.actions.logger.ActionLogger.runtime_data = runtime_data

Definition at line 33 of file logger.py.

◆ success

src.lib.actions.logger.ActionLogger.success = success

Definition at line 32 of file logger.py.


The documentation for this class was generated from the following file: