Replaced Criterrion with CMock. Added few tests, currently not working properly. Random test upgrades.
26 lines
535 B
C
26 lines
535 B
C
#include "logger.h"
|
|
#include "stdarg.h"
|
|
|
|
const char* log_levels[] = {
|
|
"[TRACE]", "[DEBUG]", "[INFO]", "WARNING", "[ERROR]", "[FATAL]"
|
|
};
|
|
|
|
#ifndef LOGLEVEL
|
|
#define LOGLEVEL LOGLEVEL_DEBUG
|
|
#endif
|
|
|
|
void _log_log(unsigned int level, const char* file, int line, const char* fmt, ...)
|
|
{
|
|
va_list list;
|
|
|
|
if (level < LOGLEVEL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
va_start(list, fmt);
|
|
fprintf(stdout, "%s %s:%d: ", log_levels[level], file, line);
|
|
vfprintf(stdout, fmt, list);
|
|
fprintf(stdout, "\n");
|
|
fflush(stdout);
|
|
} |