PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
log.h File Reference
#include <kernel/defs.h>
#include <boot/boot_info.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/io.h>
#include <sys/math.h>
#include <sys/proc.h>
Include dependency graph for log.h:

Go to the source code of this file.

Macros

#define LOG_MAX_BUFFER   0x1000
 Maximum buffer size for various logging buffers.
 
#define LOG_DEBUG(format, ...)   log_print(LOG_LEVEL_DEBUG, format __VA_OPT__(, ) __VA_ARGS__)
 
#define LOG_USER(format, ...)   log_print(LOG_LEVEL_USER, format __VA_OPT__(, ) __VA_ARGS__)
 
#define LOG_INFO(format, ...)   log_print(LOG_LEVEL_INFO, format __VA_OPT__(, ) __VA_ARGS__)
 
#define LOG_WARN(format, ...)   log_print(LOG_LEVEL_WARN, format __VA_OPT__(, ) __VA_ARGS__)
 
#define LOG_ERR(format, ...)   log_print(LOG_LEVEL_ERR, format __VA_OPT__(, ) __VA_ARGS__)
 
#define LOG_PANIC(format, ...)   log_print(LOG_LEVEL_PANIC, format __VA_OPT__(, ) __VA_ARGS__)
 

Enumerations

enum  log_output_t { LOG_OUTPUT_SERIAL = 1 << 0 , LOG_OUTPUT_SCREEN = 1 << 1 , LOG_OUTPUT_FILE = 1 << 2 }
 Logging output options. More...
 
enum  log_level_t {
  LOG_LEVEL_DEBUG , LOG_LEVEL_USER , LOG_LEVEL_INFO , LOG_LEVEL_WARN ,
  LOG_LEVEL_ERR , LOG_LEVEL_PANIC
}
 Log levels. More...
 

Functions

void log_init (void)
 Initialize the logging system.
 
void log_screen_enable (void)
 Enable logging to the screen.
 
void log_screen_disable (void)
 Disable logging to the screen.
 
void log_nprint (log_level_t level, const char *string, uint64_t length)
 Print a unformatted log message.
 
void log_print (log_level_t level, const char *format,...)
 Print a formatted log message.
 
void log_vprint (log_level_t level, const char *format, va_list args)
 Print a formatted log message with a va_list.