teditor
1.8.0@@fee5e94
Terminal based editor written in C++
|
Go to the documentation of this file.
10 template <
typename Clazz,
typename ClazzArgs>
14 ASSERT(Clazz::inst ==
nullptr,
15 "Singleton object is already initialized!");
16 Clazz::inst =
new Clazz(args);
20 if(Clazz::inst !=
nullptr)
delete Clazz::inst;
21 Clazz::inst =
nullptr;
31 static void log(
int lev,
const char* fmt, ...);
37 Logger(
const std::string& file_);
40 bool removeNewLine(std::string& buf);
49 #define CMBAR(ed, fmt, ...) Logger::msgBar(ed, fmt, ##__VA_ARGS__)
50 #define MESSAGE(ed, fmt, ...) Logger::messages(ed, fmt, ##__VA_ARGS__)
52 #define CMBAR_MSG(ed, fmt, ...) do { \
53 CMBAR(ed, fmt, ##__VA_ARGS__); \
54 MESSAGE(ed, fmt, ##__VA_ARGS__); \
57 #define LOG(lev, fmt, ...) do { \
58 Logger::log(lev, "%s:%d: Lev=%d DLev=%d ", __FILE__, __LINE__, \
59 lev, Logger::logLevel()); \
60 Logger::log(lev, fmt, ##__VA_ARGS__); \
63 #define FATAL(fmt, ...) LOG(0, fmt, ##__VA_ARGS__)
64 #define ERROR(fmt, ...) LOG(10, fmt, ##__VA_ARGS__)
65 #define WARN(fmt, ...) LOG(100, fmt, ##__VA_ARGS__)
68 #define INFO(fmt, ...) LOG(1000, fmt, ##__VA_ARGS__)
69 #define DEBUG(fmt, ...) LOG(10000, fmt, ##__VA_ARGS__)
70 #define ULTRA_DEBUG(fmt, ...) LOG(100000, fmt, ##__VA_ARGS__)
72 #define INFO(fmt, ...)
73 #define DEBUG(fmt, ...)
74 #define ULTRA_DEBUG(fmt, ...)
CmdMsgBar & getCmBar()
Definition: editor.h:34
static void messages(Editor &ed, const char *fmt,...)
Definition: logger.cpp:66
static void msgBar(Editor &ed, const char *fmt,...)
Definition: logger.cpp:55
static void log(int lev, const char *fmt,...)
Definition: logger.cpp:44
static int logLevel()
Definition: logger.cpp:15
~SingletonHandler()
Definition: logger.h:19
void clear() override
Definition: cmd_msg_bar.cpp:134
#define ASSERT(check, fmt,...)
Macro to assert with runtime_error exception if the check fails.
Definition: utils.h:35
SingletonHandler(const ClazzArgs &args)
Definition: logger.h:13
static void setLevel(int le)
Definition: logger.cpp:11
virtual void insert(char c)
Definition: buffer.cpp:25
std::string format(const char *fmt, va_list &vl)
Definition: utils.cpp:22
Buffer & getMessagesBuff()
Definition: editor.cpp:329