File tree Expand file tree Collapse file tree 6 files changed +46
-69
lines changed Expand file tree Collapse file tree 6 files changed +46
-69
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,7 @@ list(APPEND MEL_LOGGING_HEADERS
98
98
"${MEL_LOGGING_HEADERS_DIR} /Csv.hpp"
99
99
"${MEL_LOGGING_HEADERS_DIR} /File.hpp"
100
100
"${MEL_LOGGING_HEADERS_DIR} /Log.hpp"
101
- "${MEL_LOGGING_HEADERS_DIR} /LogRecord.hpp"
102
- "${MEL_LOGGING_HEADERS_DIR} /Severity.hpp"
101
+ "${MEL_LOGGING_HEADERS_DIR} /Detail/LogUtil.hpp"
103
102
"${MEL_LOGGING_HEADERS_DIR} /Table.hpp"
104
103
"${MEL_LOGGING_HEADERS_DIR} /Detail/Csv.inl"
105
104
"${MEL_LOGGING_HEADERS_DIR} /Detail/StreamMeta.hpp"
@@ -289,7 +288,7 @@ list(APPEND MEL_LOGGING_SRC
289
288
"${MEL_LOGGING_SRC_DIR} /Csv.cpp"
290
289
"${MEL_LOGGING_SRC_DIR} /File.cpp"
291
290
"${MEL_LOGGING_SRC_DIR} /Log.cpp"
292
- "${MEL_LOGGING_SRC_DIR} /LogRecord .cpp"
291
+ "${MEL_LOGGING_SRC_DIR} /LogUtil .cpp"
293
292
"${MEL_LOGGING_SRC_DIR} /Table.cpp"
294
293
)
295
294
Original file line number Diff line number Diff line change 19
19
20
20
#include < MEL/Logging/Detail/StreamMeta.hpp>
21
21
#include < sys/stat.h>
22
- #include < MEL/Logging/Severity.hpp>
23
22
#include < MEL/Core/Console.hpp>
24
23
#include < MEL/Utility/System.hpp>
25
24
#include < MEL/Core/Timestamp.hpp>
26
25
27
26
namespace mel {
28
27
28
+ // / Represents a logging severity level
29
+ enum Severity {
30
+ None = 0 , // /< always written
31
+ Fatal = 1 , // /< error that forces application abort
32
+ Error = 2 , // /< error that is fatal to operation, but not application
33
+ Warning = 3 , // /< error that may cause issues, but has been accounted for
34
+ Info = 4 , // /< useful information needed during normal operation
35
+ Verbose = 5 , // /< useful information not needed during normal operation
36
+ Debug = 6 , // /< useful information needed for diagnostics
37
+ };
38
+
39
+ inline const char * severity_to_string (Severity severity) {
40
+ switch (severity) {
41
+ case Fatal:
42
+ return " FATAL" ;
43
+ case Error:
44
+ return " ERROR" ;
45
+ case Warning:
46
+ return " WARN" ;
47
+ case Info:
48
+ return " INFO" ;
49
+ case Verbose:
50
+ return " VERB" ;
51
+ case Debug:
52
+ return " DEBUG" ;
53
+ default :
54
+ return " NONE" ;
55
+ }
56
+ }
57
+
58
+ inline Severity string_to_severity (const char * str) {
59
+ for (Severity severity = Fatal; severity <= Debug;
60
+ severity = static_cast <Severity>(severity + 1 )) {
61
+ if (severity_to_string (severity)[0 ] == str[0 ]) {
62
+ return severity;
63
+ }
64
+ }
65
+
66
+ return None;
67
+ }
68
+
29
69
// / Encapsulates a Log record
30
70
class LogRecord {
31
71
public:
Original file line number Diff line number Diff line change 17
17
18
18
#pragma once
19
19
20
- #include < MEL/Logging/LogRecord .hpp>
20
+ #include < MEL/Logging/Detail/LogUtil .hpp>
21
21
#include < iomanip>
22
22
23
23
namespace mel {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 17
17
18
18
#pragma once
19
19
20
- #include < MEL/Logging/LogRecord .hpp>
20
+ #include < MEL/Logging/Detail/LogUtil .hpp>
21
21
22
22
namespace mel {
23
23
Original file line number Diff line number Diff line change 1
- #include < MEL/Logging/LogRecord .hpp>
1
+ #include < MEL/Logging/Detail/LogUtil .hpp>
2
2
#include < cstring>
3
3
4
4
namespace mel {
You can’t perform that action at this time.
0 commit comments