feature: log level on kprintf (color)

fix: kprintf now uses concatenated strings for the flag
This commit is contained in:
2024-09-20 12:40:36 +02:00
parent 4cc1dba5f9
commit 2e41858c77
13 changed files with 99 additions and 81 deletions

View File

@ -2,18 +2,15 @@
#include <stdarg.h>
enum print_level {
KERN_EMERG,
KERN_ALERT,
KERN_CRIT,
KERN_ERR,
KERN_WARNING,
KERN_NOTICE,
KERN_INFO,
KERN_DEBUG,
KERN_DEFAULT,
KERN_CONT
};
#define KERN_EMERG "0"
#define KERN_ALERT "1"
#define KERN_CRIT "2"
#define KERN_ERR "3"
#define KERN_WARNING "4"
#define KERN_NOTICE "5"
#define KERN_INFO "6"
#define KERN_DEBUG "7"
#define KERN_DEFAULT "8"
int kprintf(int level, const char *restrict format, ...);
int kvprintf(int level, const char *restrict format, va_list ap);
int kprintf(const char *restrict format, ...);
int kvprintf(const char *restrict format, va_list ap);

View File

@ -1,6 +1,7 @@
#pragma once
#include "keyboard.h"
#include "kprintf.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@ -18,7 +19,7 @@ struct screen {
char line[256];
};
enum vga_color {
typedef enum {
VGA_COLOR_BLACK = 0,
VGA_COLOR_BLUE = 1,
VGA_COLOR_GREEN = 2,
@ -33,9 +34,9 @@ enum vga_color {
VGA_COLOR_LIGHT_CYAN = 11,
VGA_COLOR_LIGHT_RED = 12,
VGA_COLOR_LIGHT_MAGENTA = 13,
VGA_COLOR_LIGHT_BROWN = 14,
VGA_COLOR_LIGHT_YELLOW = 14,
VGA_COLOR_WHITE = 15,
};
} vga_color;
enum cursor_direction { LEFT, RIGHT, UP, DOWN };
@ -50,3 +51,4 @@ void terminal_clear(void);
struct key_event terminal_getkey(void);
void update_cursor(void);
void move_cursor(int direction);
void set_color_level(int level);