summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-17 02:28:02 +0200
committerMiguel <m.i@gmx.at>2018-08-17 02:28:02 +0200
commitc742be9c738c91703a7be787639cad167de3a6b1 (patch)
treedb0e170dab1b7f34630489d0cb1d396c92f15c79 /lib
parent559eea53ecdd1e3e45f24d15e8739419b0cd647a (diff)
started reviving my fool os
Diffstat (limited to 'lib')
-rw-r--r--lib/logger/log.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/lib/logger/log.c b/lib/logger/log.c
index e95f089..dc93784 100644
--- a/lib/logger/log.c
+++ b/lib/logger/log.c
@@ -12,35 +12,19 @@
#include "lib/string/string.h"
-
-static char buffer[LOG_BUF_SIZE];
-static int first=0;
-static int last=0;
-static bool init=true;//
-
static void log_string(char *str)
{
while(*str!=0)
{
fifo_put(&get_fool()->std_out,*(str++));
-
}
}
-static char* whitelist[]={FOOLOS_LOG_WHITELIST};
-
void log(char *module_name, int log_level, char *format_string, ...)
-{
-
+{
#ifdef FOOLOS_LOG_OFF
- for(int i=0;i<3;i++)
- {
-
- if(!strcmp(module_name,whitelist[i]))break;
- if(!strcmp("",whitelist[i]))return;
- }
+ return;
#endif
-
if(log_level<FOOLOS_LOG_LEVEL)return;
char buf_info[256];
@@ -58,19 +42,9 @@ void log(char *module_name, int log_level, char *format_string, ...)
tfp_vsprintf(buf_info,format_string,va);
va_end(va);
- tfp_sprintf(buf_log,"%s %s: %s\n",buf_time,module_name,buf_info);
-
- if(init)log_string(buf_log);
-
- for(int i=0;buf_log[i]!=0;i++)
- {
- buffer[last]=buf_log[i];
- last=(last+1)%LOG_BUF_SIZE;
- if(first<last)if(last-first>=LOG_BUF_SIZE)first=(first+1)%LOG_BUF_SIZE;
- if(last>first)if(LOG_BUF_SIZE-last+first>=LOG_BUF_SIZE)first=(first+1)%LOG_BUF_SIZE;
- }
-
+ tfp_sprintf(buf_log,"\033[36;40m%s\033[31;40m %s:\033[37;40m %s\n",buf_time,module_name,buf_info);
+ log_string(buf_log);
}
void panic(char *module_name, char *message)
@@ -84,5 +58,4 @@ void panic(char *module_name, char *message)
asm volatile("cli");
asm volatile("hlt");
}
-
}