-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommon.cpp
More file actions
39 lines (32 loc) · 775 Bytes
/
common.cpp
File metadata and controls
39 lines (32 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Copyright (C) 2016 Tolga Ceylan
*
* CopyPolicy: Released under the terms of the GNU GPL v3.0.
*/
#include "common.h"
#include <stdarg.h>
#include <stdio.h>
namespace robo {
static inline const char *get_log_level_str(LogLevel logLevel)
{
switch (logLevel)
{
case LOG_TRACE: return "TRACE ";
case LOG_DEBUG: return "DEBUG ";
case LOG_INFO: return "INFO ";
case LOG_WARN: return "WARN ";
case LOG_ERROR: return "ERROR ";
default: break;
}
return "????? ";
}
void logger(LogLevel logLevel, const char *format, ...)
{
printf("%s", get_log_level_str(logLevel));
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
printf("\n");
}
} // namespace robo