You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
686 B
40 lines
686 B
5 months ago
|
#include "app_log.h"
|
||
|
#include <stdarg.h>
|
||
|
|
||
|
|
||
|
static LOG_LEVEL nowLogLevel = LOG_LEVEL_DEBUG;
|
||
|
|
||
|
|
||
|
bool App_Log_Initialization(LOG_LEVEL level)
|
||
|
{
|
||
|
return App_Log_Set_logLevel(level);
|
||
|
}
|
||
|
|
||
|
bool App_Log_Set_logLevel(LOG_LEVEL level)
|
||
|
{
|
||
|
if(level > LOG_LEVEL_DEBUG)
|
||
|
return false;
|
||
|
nowLogLevel = level;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
LOG_LEVEL App_Lgo_Get_logLevel(void)
|
||
|
{
|
||
|
return nowLogLevel;
|
||
|
}
|
||
|
|
||
|
|
||
|
void App_Log_Prinf(LOG_LEVEL level, const char *func, const char *format, ...)
|
||
|
{
|
||
|
if(nowLogLevel >= level)
|
||
|
{
|
||
|
va_list arg;
|
||
|
fprintf(stderr, "[%d][%s] ", millis(), func);
|
||
|
va_start(arg, format);
|
||
|
vfprintf(stderr, format, arg);
|
||
|
va_end(arg);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|