UEFIStarter
a simple UEFI framework
logger.h
Go to the documentation of this file.
1 
11 #ifndef __LOGGER_H
12 #define __LOGGER_H
13 
14 #include <Uefi.h>
15 
17 #define TRACE_HERE LOG.trace(L"%a#%d",__FILE__,__LINE__);
18 
24 #define ON_ERROR_WARN(TEXT) if(result!=EFI_SUCCESS) LOG.warn(TEXT);
25 
32 #define ON_ERROR_RETURN(TEXT,RV) if(result!=EFI_SUCCESS) \
33  { \
34  LOG.error(L"%s() returned status %d (%r)",TEXT,result,result); \
35  return RV; \
36  }
37 
38 
42 typedef enum
43 {
44  OFF=0,
46  WARN,
47  INFO,
50 } LOGLEVEL;
51 
52 extern const CHAR16 *logger_level_names[];
53 
54 
61 typedef void logger_print_function_t(LOGLEVEL level, CHAR16 *msg);
62 
69 typedef void EFIAPI logger_function_t(UINT16 *fmt, ...);
70 
72 typedef struct
73 {
79 } loggers_t;
80 
81 extern const loggers_t LOG;
82 
83 
86 
88 UINTN get_logger_entry_count(LOGLEVEL level);
89 
90 void kill();
91 
93 
94 #endif
warnings: something may have broken
Definition: logger.h:46
logger_print_function_t * set_logger_function(logger_print_function_t *func)
Sets a new log writer.
Definition: logger.c:191
LOGLEVEL set_log_level(LOGLEVEL level)
Sets a new log level.
Definition: logger.c:43
UINTN get_logger_entry_count(LOGLEVEL level)
Gets a log level&#39;s message count.
Definition: logger.c:164
const loggers_t LOG
The global logging facility.
Definition: logger.c:139
logger_function_t * info
logger for INFO level
Definition: logger.h:76
void EFIAPI logger_function_t(UINT16 *fmt,...)
function pointer for logging functions to be invoked directly
Definition: logger.h:69
debug messages: something breaks and I&#39;m trying to fix it
Definition: logger.h:48
trace messages: something breaks and I don&#39;t know what or where
Definition: logger.h:49
error messages: something definitely broke
Definition: logger.h:45
void kill()
Immediately halts the UEFI environment.
Definition: logger.c:179
LOGLEVEL
the list of log levels
Definition: logger.h:42
logger_function_t * error
logger for ERROR level
Definition: logger.h:78
logger_function_t * warn
logger for WARN level
Definition: logger.h:77
void logger_print_function_t(LOGLEVEL level, CHAR16 *msg)
function pointer for log output functions
Definition: logger.h:61
disable logging: la-la-la, I can&#39;t hear you
Definition: logger.h:44
void reset_logger_entry_counts()
Resets all log levels&#39; message counts.
Definition: logger.c:151
informative messages: just in case something breaks
Definition: logger.h:47
logger_function_t * trace
logger for TRACE level
Definition: logger.h:74
logging facility data type, contains logging function pointer for each log level
Definition: logger.h:72
const CHAR16 * logger_level_names[]
list of log level&#39;s printable names
Definition: logger.c:17
logger_function_t * debug
logger for DEBUG level
Definition: logger.h:75
LOGLEVEL get_log_level()
Fetches the current log level.
Definition: logger.c:31