diff options
Diffstat (limited to 'lib/logger/log.c')
| -rw-r--r-- | lib/logger/log.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/logger/log.c b/lib/logger/log.c index fd226e5..c9bb652 100644 --- a/lib/logger/log.c +++ b/lib/logger/log.c @@ -1,13 +1,24 @@ #include "log.h" #include <stdarg.h> +#include "lib/int/stdint.h" void PutConsole(char *str, int color, va_list va); +volatile uint64_t task_system_clock; // in task.c + void log(char *module_name, int log_level, char *format_string, ...) { if(log_level<FOOLOS_LOG_INFO)return; + char buf[10]; + uint32_t t=task_system_clock; + uint32_t s=t/25; + uint32_t ms=t*1000/25-1000*s; + + tfp_sprintf(buf,"[%6d.%05d] ",s,ms); + + PutConsole(buf,0b0111101111101111,task_system_clock); PutConsole(module_name,0b1111100000000000,0); PutConsole(": ",0b0000011111100000,0); va_list va; @@ -19,6 +30,7 @@ void log(char *module_name, int log_level, char *format_string, ...) } + void panic(char *module_name, char *format_string) { @@ -27,9 +39,6 @@ void panic(char *module_name, char *format_string) PutConsole(" : ",0b0000011111100000,0); PutConsole(format_string,0b1111100000000000,0); - while(1); // halt - - } |
