VL
Log.h
Go to the documentation of this file.
1#pragma once
2
3//#define LOG_LEVEL_VERBOSE
4
5#ifdef LOG_ON
6 #include <iostream>
7 #define LOG_TITLE(title) namespace { const char* logTitle = title; }
8 #define LOG_STREAM(s) namespace {auto logStream = s;}
9 #define SET_LOG_VERBOSE(boolVal) namespace { bool verboseLevel = boolVal;}
10 #define SET_LOG_DEBUG(boolVal) namespace { bool debugLevel = boolVal; }
11 #define LOCAL_LOG(msg) logStream() << "[" << logTitle << "] " << msg
12 #define LOCAL_DEBUG(msg) { if (debugLevel) { logStream() << "[" << logTitle << "] [D]" << msg << "\n"; } };
13 #define LOCAL_ERROR(msg) logStream() << "[" << logTitle << "] " << "Error! " << msg << "\n"
14 #define LOCAL_WARNING(msg) logStream() << "[" << logTitle << "] " << "Warning: " << msg << "\n"
15 #define LOCAL_INFO(msg) logStream() << "[" << logTitle << "] " << msg << "\n"
16 #define LOCAL_VERBOSE(msg) { if (verboseLevel) { logStream() << "[" << logTitle << "] " << "[V] " << msg << "\n"; } };
17 #ifdef LOG_LEVEL_VERBOSE
18 #define LOG_VERBOSE(msg) std::cout << "[V] " << msg << "\n"
19 #else
20 #define LOG_VERBOSE(msg)
21 #endif
22 #define LOG(msg) std::cout << msg
23 #define LOG_DEBUG(msg) std::cout << msg
24 #define LOG_ERROR(msg) std::cout << "Error! " << msg << "\n"
25 #define LOG_WARNING(msg) std::cout << "Warning: " << msg << "\n"
26 #define LOG_INFO(msg) std::cout << msg << "\n"
27#else
28 #define LOG_TITLE(title)
29 #define LOG_STREAM(s)
30 #define SET_LOG_VERBOSE(boolVal)
31 #define SET_LOG_DEBUG(boolVal)
32 #define LOCAL_LOG(msg)
33 #define LOCAL_DEBUG(msg)
34 #define LOCAL_WARNING(msg)
35 #define LOCAL_ERROR(msg)
36 #define LOCAL_INFO(msg)
37 #define LOCAL_VERBOSE(msg)
38 #define LOG(msg)
39 #define LOG_DEBUG(msg)
40 #define LOG_WARNING(msg)
41 #define LOG_ERROR(msg)
42 #define LOG_INFO(msg)
43 #define LOG_VERBOSE(msg)
44#endif
45
46