diff options
| author | Miguel <m.i@gmx.at> | 2018-08-22 14:46:13 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-08-22 14:46:13 +0200 |
| commit | eddfc270d887283674563530b9fd982a2692f8c3 (patch) | |
| tree | cd6f0269bdb971e5921226d2594d303f2855ea98 /lib | |
| parent | d99ddc6f38879fb30eaeb7dcafe25d1476613cb1 (diff) | |
cleaning up
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/logger/log.c | 63 | ||||
| -rw-r--r-- | lib/logger/log.h | 13 |
2 files changed, 0 insertions, 76 deletions
diff --git a/lib/logger/log.c b/lib/logger/log.c deleted file mode 100644 index ff1b8bf..0000000 --- a/lib/logger/log.c +++ /dev/null @@ -1,63 +0,0 @@ -#define FOOLOS_MODULE_NAME "log" -#include "log.h" - -#include <stdarg.h> -#include <stdbool.h> - -#include "kernel/kernel.h" -#include "kernel/fifo.h" - -#include "lib/string/string.h" - -static void log_string(char *str) -{ -// if(get_max_fd()>=2) syscall_write(2,str,strlen(str)); - while(*str!=0) - { - serial_write(*str++); - } -} - -void log(char *module_name, int log_level, char *format_string, ...) -{ - #ifdef FOOLOS_LOG_OFF - return; - #endif - - if(log_level<FOOLOS_LOG_LEVEL)return; - - char buf_info[256]; - char buf_log[256]; - char buf_time[20]; - - uint64_t t=timer_get_uptime_ms(); - uint32_t ms=t%1000; - uint32_t s=t/1000; - - tfp_sprintf(buf_time,"[%04d %03d]",s,ms); - - va_list va; - va_start(va,format_string); - tfp_vsprintf(buf_info,format_string,va); - va_end(va); - - tfp_sprintf(buf_log,"\033[36;40m%s\033[31;40m %10s:\033[37;40m %s\n",buf_time,module_name,buf_info); - - log_string(buf_log); -} - -void panic(char *module_name, char *message) -{ - char buf_log[256]; - tfp_sprintf(buf_log,"\033[41;37m\n !! KERNEL PANIC !! %s: %s\n\n\033[37;40m",module_name,message); - - //PANIC DIRECTLY TO STDOUT// - syscall_write(1,buf_log,strlen(buf_log)); - log_string(buf_log); - - while(1) - { - asm volatile("cli"); - asm volatile("hlt"); - } -} diff --git a/lib/logger/log.h b/lib/logger/log.h deleted file mode 100644 index 38f1219..0000000 --- a/lib/logger/log.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef FOOLOS_LOG_H -#define FOOLOS_LOG_H - -#define FOOLOS_LOG_ERROR 5 -#define FOOLOS_LOG_WARNING 4 -#define FOOLOS_LOG_INFO 3 -#define FOOLOS_LOG_DEBUG 2 -#define FOOLOS_LOG_FINE 1 - -void log(char *module_name, int prio, char *format_string, ...); -void panic(char *module_name, char *format_string); - -#endif |
