-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.hpp
executable file
·38 lines (32 loc) · 967 Bytes
/
log.hpp
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
#ifndef LOGNYA_HPP
#define LOGNYA_HPP
/**
* easylogging - well documented logging library with a good variety of pretty prints.
*
* // Example
* error_log << "Number %d shouldn't be here"s % 5;
*
*/
#include <easylogging++.h>
#include <nya/format.hpp>
#define trace_log LOG(TRACE)
#define info_log LOG(INFO)
#define error_log LOG(ERROR)
#define fatal_log LOG(FATAL)
#define trace_raw CLOG(TRACE, "raw")
#define info_raw CLOG(INFO, "raw")
#define error_raw CLOG(ERROR, "raw")
#define fatal_raw CLOG(FATAL, "raw")
#define nya_thread_name el::Helpers::setThreadName
namespace nya
{
template<typename...> inline void init_logs(const char* configPath)
{
el::Loggers::configureFromGlobal(configPath);
el::Configurations rawConf;
rawConf.parseFromText("*GLOBAL:\n FORMAT = %msg", el::Loggers::getLogger("default")->configurations());
el::Loggers::getLogger("raw")->configure(rawConf);
nya_thread_name("_main_");
}
} // namespace nya
#endif //LOGNYA_HPP