diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/logger/log.c | 14 | ||||
| -rw-r--r-- | lib/string/string.c | 4 | ||||
| -rw-r--r-- | lib/string/string.h | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/lib/logger/log.c b/lib/logger/log.c index ef68a2e..e95f089 100644 --- a/lib/logger/log.c +++ b/lib/logger/log.c @@ -10,13 +10,14 @@ #include "kernel/timer.h" #include "kernel/fifo.h" +#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) @@ -26,14 +27,21 @@ static void log_string(char *str) } } +static char* whitelist[]={FOOLOS_LOG_WHITELIST}; + void log(char *module_name, int log_level, char *format_string, ...) { #ifdef FOOLOS_LOG_OFF - return; + for(int i=0;i<3;i++) + { + + if(!strcmp(module_name,whitelist[i]))break; + if(!strcmp("",whitelist[i]))return; + } #endif - if(log_level<FOOLOS_LOG_INFO)return; + if(log_level<FOOLOS_LOG_LEVEL)return; char buf_info[256]; char buf_log[256]; diff --git a/lib/string/string.c b/lib/string/string.c index be2c7ed..2405483 100644 --- a/lib/string/string.c +++ b/lib/string/string.c @@ -29,12 +29,12 @@ int strcmp_l(char *str1, char *str2, int length) } } -static int strcmp(char *str1, char *str2) + +strcmp(char *str1, char *str2) { return strcmp_l(str1,str2,0); } - int strlen(const char* string) { int result = 0; diff --git a/lib/string/string.h b/lib/string/string.h index e41eb94..bd43b34 100644 --- a/lib/string/string.h +++ b/lib/string/string.h @@ -3,6 +3,7 @@ void* memcpy(void* restrict dstptr, const void* restrict srcptr, int size); +int strcmp(char *str1, char *str2); int strcmp_l(char *str1, char *str2, int length); #endif |
