MonkOS  v0.1
A simple 64-bit operating system (x86_64)
log.h File Reference
#include <core.h>
#include <stdarg.h>

Go to the source code of this file.

Typedefs

typedef void(* log_callback) (loglevel_t level, const char *msg)
 Callback handler called when a message is logged. More...
 

Enumerations

Functions

void log_addcallback (loglevel_t maxlevel, log_callback cb)
 Add a callback handler for log messages. More...
 
void log_removecallback (log_callback cb)
 Remove a callback handler for log messages. More...
 
void log (loglevel_t level, const char *str)
 Log a message to the kernel log buffer. More...
 
void logf (loglevel_t level, const char *format,...)
 Log a printf-formatted message to the kernel log buffer. More...
 
void logvf (loglevel_t level, const char *format, va_list args)
 Log a printf-formatted string using a variable argument list. More...
 

Typedef Documentation

typedef void(* log_callback) (loglevel_t level, const char *msg)

Callback handler called when a message is logged.

Parameters
[in]levelThe log level of the message.
[in]msgThe null-terminated string containing the logged message.

Definition at line 36 of file log.h.

Enumeration Type Documentation

enum loglevel_t

A log level indicates the importance of a logged message.

Enumerator
LOG_CRIT 

Critical error, occurs just prior to crashing.

LOG_ERR 

Serious error in software or hardware.

LOG_WARNING 

Warning about a significant issue.

LOG_INFO 

Informational message.

LOG_DEBUG 

Used for kernel debugging.

LOG_DEFAULT 

Default kernel logging level.

Definition at line 19 of file log.h.

Function Documentation

void log_addcallback ( loglevel_t  maxlevel,
log_callback  cb 
)

Add a callback handler for log messages.

Parameters
[in]maxlevelIssue callback for log calls up to and including this log level.
[in]cbThe callback function

Definition at line 165 of file log.c.

void log_removecallback ( log_callback  cb)

Remove a callback handler for log messages.

Parameters
[in]cbThe callback function

Definition at line 176 of file log.c.

void log ( loglevel_t  level,
const char *  str 
)

Log a message to the kernel log buffer.

Parameters
[in]levelThe importance level of the logged message.
[in]strThe null-terminated string to be printed.

Definition at line 188 of file log.c.

void logf ( loglevel_t  level,
const char *  format,
  ... 
)

Log a printf-formatted message to the kernel log buffer.

Parameters
[in]levelThe importance level of the logged message.
[in]formatThe null-terminated format string used to format the text to be printed.
[in]...Variable arguments list to be initialized with va_start.

Definition at line 195 of file log.c.

Referenced by acpi_init(), read_rsdt(), and read_xsdt().

void logvf ( loglevel_t  level,
const char *  format,
va_list  args 
)

Log a printf-formatted string using a variable argument list.

Parameters
[in]levelThe importance level of the logged message.
[in]formatThe null-terminated format string used to format the text to be printed.
[in]argsVariable arguments list to be initialized with va_start.

Definition at line 204 of file log.c.

Referenced by logf().