Python YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin.logs Namespace Reference

Classes

class  LogLevel
 

Functions

None set_log_level (LogLevel level)
 Sets the log level for the logs.
 
str log_level_to_name (LogLevel level)
 
List[Union[str, int]] get_caller_info ()
 
None default_log_message (LogLevel level, str file, str function, int line, str text)
 
None log_helper (LogLevel level, str file, str function, int line, str text)
 
None YASMIN_LOG_ERROR (str text)
 
None YASMIN_LOG_WARN (str text)
 
None YASMIN_LOG_INFO (str text)
 
None YASMIN_LOG_DEBUG (str text)
 
None set_loggers (Callable[[LogLevel, str], None] new_log_message)
 
None set_default_loggers ()
 

Variables

list __all__
 
 level
 
 NOTSET
 
 format
 
 log_level = LogLevel.INFO
 The current log level for the application.
 
None log_message = default_log_message
 

Function Documentation

◆ default_log_message()

None yasmin.logs.default_log_message ( LogLevel level,
str file,
str function,
int line,
str text )
Default logging function.

This function is the default logging function of YASMIN.

@param level The log level as a string (e.g., "ERROR", "WARN", "INFO",
"DEBUG").
@param file The source file where the log function is called.
@param function The function where the log function is called.
@param line The line number in the source file.
@param text The format string for the log message.
@param args Additional arguments for the format string.

◆ get_caller_info()

List[Union[str, int]] yasmin.logs.get_caller_info ( )
Retrieve information about the caller of the current function.

This function inspects the call stack to obtain the file name, function
name, and line number of the caller.

@return: A tuple containing the file name, function name, and line number.
@rtype: tuple[str, str, int]

◆ log_helper()

None yasmin.logs.log_helper ( LogLevel level,
str file,
str function,
int line,
str text )
@brief Variadic template function to log messages at different levels.

This function wraps log_message and allows logging messages with different
log levels while reducing redundant code. It provides a consistent logging
format across all levels.

@tparam LEVEL The log level LogLevel (e.g., 0 -> "ERROR", 1 -> "WARN", 2 ->
"INFO", 3 -> "DEBUG").
@param log_message Function to create the logs
@param file The source file where the log function is called.
@param function The function where the log function is called.
@param line The line number in the source file.
@param text The format string for the log message.
@param ... Additional arguments for the format string.

◆ log_level_to_name()

str yasmin.logs.log_level_to_name ( LogLevel level)

◆ set_default_loggers()

None yasmin.logs.set_default_loggers ( )
Sets the default logging function for all log levels.

This function initializes the logging function to the default
implementations.

◆ set_log_level()

None yasmin.logs.set_log_level ( LogLevel level)

Sets the log level for the logs.

@brief Set the log level for the YASMIN framework.

Adjusts the log level to control the verbosity of logged messages.

@param level The new log level to be set.

◆ set_loggers()

None yasmin.logs.set_loggers ( Callable[[LogLevel, str], None] new_log_message)
Set custom logger functions for YASMIN logging.

This function assigns user-defined logging function for different log
levels: info, warning, debug, and error.

@param log_message: A callable function for logging messages.
@type info: Callable[[LogLevel, str], None]

@return: None

@raises TypeError: If any of the parameters are not callable.

◆ YASMIN_LOG_DEBUG()

None yasmin.logs.YASMIN_LOG_DEBUG ( str text)
Log a debug message with the caller's information.

This function formats the log message to include the file name, function
name, and line number where the log function was called.

@param text: The debug message to log.
@type text: str

@return: None

◆ YASMIN_LOG_ERROR()

None yasmin.logs.YASMIN_LOG_ERROR ( str text)
Log an error message with the caller's information.

This function formats the log message to include the file name, function
name, and line number where the log function was called.

@param text: The error message to log.
@type text: str

@return: None

◆ YASMIN_LOG_INFO()

None yasmin.logs.YASMIN_LOG_INFO ( str text)
Log an informational message with the caller's information.

This function formats the log message to include the file name, function
name, and line number where the log function was called.

@param text: The informational message to log.
@type text: str

@return: None

◆ YASMIN_LOG_WARN()

None yasmin.logs.YASMIN_LOG_WARN ( str text)
Log a warning message with the caller's information.

This function formats the log message to include the file name, function
name, and line number where the log function was called.

@param text: The warning message to log.
@type text: str

@return: None

Variable Documentation

◆ __all__

list yasmin.logs.__all__
private
Initial value:
1= [
2 "LogLevel",
3 "log_level",
4 "set_log_level",
5 "log_level_to_name",
6 "log_message",
7 "YASMIN_LOG_ERROR",
8 "YASMIN_LOG_WARN",
9 "YASMIN_LOG_INFO",
10 "YASMIN_LOG_DEBUG",
11 "set_loggers",
12 "set_default_loggers",
13]

◆ format

yasmin.logs.format

◆ level

yasmin.logs.level

◆ log_level

yasmin.logs.log_level = LogLevel.INFO

The current log level for the application.

◆ log_message

None yasmin.logs.log_message = default_log_message

◆ NOTSET

yasmin.logs.NOTSET