|
17 | 17 |
|
18 | 18 | #pragma once
|
19 | 19 |
|
20 |
| -#include <MEL/Logging/Formatters/CsvFormatter.hpp> |
21 | 20 | #include <MEL/Logging/Formatters/TxtFormatter.hpp>
|
22 | 21 | #include <MEL/Logging/Writers/ColorConsoleWriter.hpp>
|
23 | 22 | #include <MEL/Logging/Writers/RollingFileWriter.hpp>
|
|
26 | 25 | #include <cstring>
|
27 | 26 | #include <vector>
|
28 | 27 |
|
29 |
| -#ifndef DEFAULT_MEL_LOGGER |
| 28 | +#ifndef DEFAULT_MEL_LOG |
30 | 29 | #define DEFAULT_LOGGER 0
|
31 | 30 | #endif
|
32 | 31 |
|
@@ -124,31 +123,25 @@ inline Logger<instance>& init_logger(Severity max_severity,
|
124 | 123 | return init_logger<instance>(max_severity, &rollingFilewriter);
|
125 | 124 | }
|
126 | 125 |
|
127 |
| -/// Initializes a logger with RollingFileWriter and Txt/CsvFormatter chosen by |
128 |
| -/// file extension (specific logger instance) |
| 126 | +/// Initializes a logger with RollingFileWriter and TxtFormatter |
129 | 127 | template <int instance>
|
130 | 128 | inline Logger<instance>& init_logger(Severity max_severity,
|
131 | 129 | const char* filename,
|
132 | 130 | size_t max_file_size = 0,
|
133 | 131 | int max_files = 0) {
|
134 |
| - const char* dot = std::strrchr(filename, '.'); |
135 |
| - if (dot && 0 == std::strcmp(dot, ".csv")) |
136 |
| - return init_logger<CsvFormatter, instance>(max_severity, filename, |
137 |
| - max_file_size, max_files); |
138 |
| - else |
139 |
| - return init_logger<TxtFormatter, instance>(max_severity, filename, |
140 |
| - max_file_size, max_files); |
| 132 | + return init_logger<TxtFormatter, instance>(max_severity, filename, |
| 133 | + max_file_size, max_files); |
141 | 134 | }
|
142 | 135 |
|
143 | 136 | //==============================================================================
|
144 | 137 | // DEFAULT MEL LOGGER
|
145 | 138 | //==============================================================================
|
146 | 139 |
|
147 |
| -/// Built in MEL Logger. Contains two writers: (0) a RollingFileWriter with a |
| 140 | +/// Built in MEL Log. Contains two writers: (0) a RollingFileWriter with a |
148 | 141 | /// TxtFormatter and default severity Verbose, and (1) a ColorConsoleWriter with
|
149 | 142 | /// TxtFormatter and default severity Info. Can be disabled by defining
|
150 | 143 | /// MEL_DISABLE_LOG or enabling DISABLE_LOG option in CMakeLists.txt
|
151 |
| -extern Logger<DEFAULT_LOGGER>* MEL_LOGGER; |
| 144 | +extern Logger<DEFAULT_LOGGER>* MEL_LOG; |
152 | 145 |
|
153 | 146 | } // namespace mel
|
154 | 147 |
|
@@ -177,14 +170,14 @@ extern Logger<DEFAULT_LOGGER>* MEL_LOGGER;
|
177 | 170 |
|
178 | 171 | /// Log severity level checker for default MEL logger
|
179 | 172 | #define IF_LOG(severity) \
|
180 |
| - if (!MEL_LOGGER || !MEL_LOGGER->check_severity(severity)) { \ |
| 173 | + if (!MEL_LOG || !MEL_LOG->check_severity(severity)) { \ |
181 | 174 | ; \
|
182 | 175 | } else
|
183 | 176 |
|
184 | 177 | /// Main logging macro for defaulter MEL logger
|
185 | 178 | #define LOG(severity) \
|
186 | 179 | IF_LOG(severity) \
|
187 |
| - *MEL_LOGGER += LogRecord(severity, LOG_GET_FUNC(), __LINE__, LOG_GET_FILE()) |
| 180 | + *MEL_LOG += LogRecord(severity, LOG_GET_FUNC(), __LINE__, LOG_GET_FILE()) |
188 | 181 |
|
189 | 182 | /// Conditional logging macro for default MEL logger
|
190 | 183 | #define LOG_IF(severity, condition) \
|
|
0 commit comments