summaryrefslogtreecommitdiff
path: root/lib/logger/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/logger/log.c')
-rw-r--r--lib/logger/log.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/logger/log.c b/lib/logger/log.c
index 703658a..d58d2d6 100644
--- a/lib/logger/log.c
+++ b/lib/logger/log.c
@@ -14,23 +14,16 @@
static char buffer[LOG_BUF_SIZE];
static int first=0;
static int last=0;
-static bool init=false;
void log(char *module_name, int log_level, char *format_string, ...)
{
-#ifdef FOOLOS_LOG_OFF
+ #ifdef FOOLOS_LOG_OFF
return;
-#endif
+ #endif
if(log_level<FOOLOS_LOG_INFO)return;
- if(!init)
- {
- init=true;
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"buffer: 0x%08X, first=%08X, last=%08X",buffer,&first,&last);
- }
-
char buf_info[256];
char buf_log[256];
char buf_time[20];
@@ -39,7 +32,7 @@ void log(char *module_name, int log_level, char *format_string, ...)
uint32_t s=t/25;
uint32_t ms=t*1000/25-1000*s;
- tfp_sprintf(buf_time,"[%3d.%05d] ",s,ms);
+ tfp_sprintf(buf_time,"[%3d.%05d]",s,ms);
va_list va;
va_start(va,format_string);
@@ -71,6 +64,13 @@ void panic(char *module_name, char *message)
void log_log()
{
+ #ifdef FOOLOS_LOG_OFF
+ return;
+ #endif
+
+ char buf_log[256];
+ tfp_sprintf(buf_log,"[ 0.00000] log: buffer state: first=%d, last=%d, buf_size=%d\n",first,last,LOG_BUF_SIZE);
+ console_put_str(buf_log);
for(int i=first;i!=last;i++)
{
console_put_char(buffer[i]);