PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
log.c File Reference
#include <kernel/log/log.h>
#include <kernel/cpu/cpu.h>
#include <kernel/drivers/com.h>
#include <kernel/init/boot_info.h>
#include <kernel/log/log_file.h>
#include <kernel/log/log_screen.h>
#include <kernel/sched/clock.h>
#include <kernel/sched/timer.h>
#include <kernel/sync/lock.h>
#include <boot/boot_info.h>
#include <kernel/version.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/io.h>
#include <sys/proc.h>
Include dependency graph for log.c:

Go to the source code of this file.

Functions

static void log_splash (void)
 
void log_init (void)
 Initialize the logging system.
 
void log_screen_enable ()
 Enable logging to the screen.
 
void log_screen_disable (void)
 Disable logging to the screen.
 
static void log_write (const char *string, uint64_t length)
 
static void log_print_header (log_level_t level)
 
static void log_handle_char (log_level_t level, char chr)
 
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.
 

Variables

static lock_t lock = LOCK_CREATE()
 
static char lineBuffer [LOG_MAX_BUFFER] = {0}
 
static char workingBuffer [LOG_MAX_BUFFER] = {0}
 
static log_output_t outputs = 0
 
static log_level_t minLevel = 0
 
static bool isLastCharNewline = 0
 
static bool firstHeaderPrinted = false
 
static const char * levelNames []
 

Function Documentation

◆ log_splash()

static void log_splash ( void  )
static

Definition at line 39 of file log.c.

Here is the caller graph for this function:

◆ log_write()

static void log_write ( const char *  string,
uint64_t  length 
)
static

Definition at line 96 of file log.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ log_print_header()

static void log_print_header ( log_level_t  level)
static

Definition at line 117 of file log.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ log_handle_char()

static void log_handle_char ( log_level_t  level,
char  chr 
)
static

Definition at line 146 of file log.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ lock

lock_t lock = LOCK_CREATE()
static

Definition at line 21 of file log.c.

◆ lineBuffer

char lineBuffer[LOG_MAX_BUFFER] = {0}
static

Definition at line 23 of file log.c.

◆ workingBuffer

char workingBuffer[LOG_MAX_BUFFER] = {0}
static

Definition at line 24 of file log.c.

◆ outputs

log_output_t outputs = 0
static

Definition at line 25 of file log.c.

◆ minLevel

log_level_t minLevel = 0
static

Definition at line 26 of file log.c.

◆ isLastCharNewline

bool isLastCharNewline = 0
static

Definition at line 27 of file log.c.

◆ firstHeaderPrinted

bool firstHeaderPrinted = false
static

Definition at line 28 of file log.c.

◆ levelNames

const char* levelNames[]
static
Initial value:
= {
[LOG_LEVEL_DEBUG] = "D",
[LOG_LEVEL_USER] = "U",
[LOG_LEVEL_INFO] = "I",
[LOG_LEVEL_WARN] = "W",
[LOG_LEVEL_ERR] = "E",
[LOG_LEVEL_PANIC] = "P",
}
@ LOG_LEVEL_ERR
Definition log.h:46
@ LOG_LEVEL_DEBUG
Definition log.h:42
@ LOG_LEVEL_USER
Definition log.h:43
@ LOG_LEVEL_WARN
Definition log.h:45
@ LOG_LEVEL_PANIC
Definition log.h:47
@ LOG_LEVEL_INFO
Definition log.h:44

Definition at line 30 of file log.c.