Browse Source

correct log levels

dev
Milang 2 years ago
parent
commit
149b825d61
  1. 26
      liblog.c
  2. 2
      liblog.h

26
liblog.c

@ -42,7 +42,7 @@ static log_line* current_line=&first_line;
static int number_messages=0;
static log_level_t priority=LOG_INFO;
static log_level_t priority=LEVEL_INFO;
static log_line* cut_line()
{
@ -80,14 +80,14 @@ int ll_get_size();
void ll_set_state(log_state_t s)
{
if (s==LOG_DISABLE)
priority=LOG_QUIET;
priority=LEVEL_QUIET;
if (s==LOG_ENABLE)
priority=LOG_INFO;
priority=LEVEL_INFO;
}
int ll_get_state()
log_state_t ll_get_state()
{
if (priority=LOG_QUIET)
if (priority=LEVEL_QUIET)
return 0;
else
return 1;
@ -184,7 +184,7 @@ static void append_character(char c)
// log something
void ll_send(const char * txt)
{
if (priority!=LOG_QUIET)
if (priority!=LEVEL_QUIET)
{
char c=1;
int i=0;
@ -283,7 +283,7 @@ void ll_pause()
GNORETURN void ll_panic(uint32_t code)
{
char str[10];
sprintf(str, "\nException !\n>> ErrCode=%d", state, code);
sprintf(str, "\nException !\n>> ErrCode=%d",code);
ll_set_state(1);
ll_send(str);
while (1)
@ -294,3 +294,15 @@ void ll_set_panic()
{
gint_panic_set(ll_panic);
}
void ll_set_level(log_level_t l)
{
priority=l;
}
log_level_t ll_get_level(void)
{
return priority;
}

2
liblog.h

@ -40,7 +40,7 @@ void ll_set_level(log_level_t);
/* ll_get_level():
return log level */
log_level_t ll_set_level(void);
log_level_t ll_get_level(void);

Loading…
Cancel
Save