|
Python YASMIN (Yet Another State MachINe)
|
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 |
| 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.
| 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]
| 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.
| str yasmin.logs.log_level_to_name | ( | LogLevel | level | ) |
| 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.
| 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.
| 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.
| 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
| 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
| 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
| 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
|
private |
| yasmin.logs.format |
| yasmin.logs.level |
| yasmin.logs.log_level = LogLevel.INFO |
The current log level for the application.
| None yasmin.logs.log_message = default_log_message |
| yasmin.logs.NOTSET |