UEFIStarter
a simple UEFI framework
|
Logging facility, supports verbosity levels. More...
#include <Uefi.h>
Go to the source code of this file.
Data Structures | |
struct | loggers_t |
logging facility data type, contains logging function pointer for each log level More... | |
Macros | |
#define | TRACE_HERE LOG.trace(L"%a#%d",__FILE__,__LINE__); |
helper macro to log a TRACE message containing the current file and line | |
#define | ON_ERROR_WARN(TEXT) if(result!=EFI_SUCCESS) LOG.warn(TEXT); |
helper macro to quickly log a WARN message if an EFI result is anything but EFI_SUCCESS More... | |
#define | ON_ERROR_RETURN(TEXT, RV) |
helper macro to quickly log an ERROR message and return if an EFI result is anything but EFI_SUCCESS More... | |
Typedefs | |
typedef void | logger_print_function_t(LOGLEVEL level, CHAR16 *msg) |
function pointer for log output functions More... | |
typedef void EFIAPI | logger_function_t(UINT16 *fmt,...) |
function pointer for logging functions to be invoked directly More... | |
Enumerations | |
enum | LOGLEVEL { OFF =0, ERROR, WARN, INFO, DEBUG, TRACE } |
the list of log levels More... | |
Functions | |
LOGLEVEL | get_log_level () |
Fetches the current log level. More... | |
LOGLEVEL | set_log_level (LOGLEVEL level) |
Sets a new log level. More... | |
void | reset_logger_entry_counts () |
Resets all log levels' message counts. More... | |
UINTN | get_logger_entry_count (LOGLEVEL level) |
Gets a log level's message count. More... | |
void | kill () |
Immediately halts the UEFI environment. More... | |
logger_print_function_t * | set_logger_function (logger_print_function_t *func) |
Sets a new log writer. More... | |
Variables | |
const CHAR16 * | logger_level_names [] |
list of log level's printable names | |
const loggers_t | LOG |
The global logging facility. More... | |
Logging facility, supports verbosity levels.
#define ON_ERROR_WARN | ( | TEXT | ) | if(result!=EFI_SUCCESS) LOG.warn(TEXT); |
helper macro to quickly log a WARN message if an EFI result is anything but EFI_SUCCESS
TEXT | the text to log |
#define ON_ERROR_RETURN | ( | TEXT, | |
RV | |||
) |
helper macro to quickly log an ERROR message and return if an EFI result is anything but EFI_SUCCESS
TEXT | the text to log |
RV | the value to return |
typedef void logger_print_function_t(LOGLEVEL level, CHAR16 *msg) |
function pointer for log output functions
level | the log level to output at |
msg | the log message to print, as UTF-16 |
typedef void EFIAPI logger_function_t(UINT16 *fmt,...) |
function pointer for logging functions to be invoked directly
fmt | the message's format string, as UTF-16 - takes same format as Print() functions |
... | any additional arguments matching the format string placeholders |
enum LOGLEVEL |
the list of log levels
LOGLEVEL get_log_level | ( | ) |
Fetches the current log level.
Sets a new log level.
You can disable logging by calling this with log level "OFF".
level | the new log level to use |
void reset_logger_entry_counts | ( | ) |
Resets all log levels' message counts.
Used e.g. by the test framework to detect which tests generated errors.
UINTN get_logger_entry_count | ( | LOGLEVEL | level | ) |
Gets a log level's message count.
level | the log level to get the count for |
void kill | ( | ) |
Immediately halts the UEFI environment.
Use this to e.g. debug issues in graphical animations where it's vital to stop everything before the target gets painted over.
Technically the emitted interrupt 3 is usually used for debuggers but the UEFI specification requires INT 3 to be unassigned by default, thus halting everything. If you use this function with a debugger attached this will probably trigger the debugger instead.
logger_print_function_t* set_logger_function | ( | logger_print_function_t * | func | ) |
Sets a new log writer.
Use this to replace the built-in text mode writer, e.g. to output log messages in a graphical environment
func | the new log writer function |
const loggers_t LOG |
The global logging facility.
This contains function pointers for each log level, so users can call e.g. LOG.debug() to log a debug message.