File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,8 +98,7 @@ list(APPEND MEL_LOGGING_HEADERS
9898 "${MEL_LOGGING_HEADERS_DIR} /Csv.hpp"
9999 "${MEL_LOGGING_HEADERS_DIR} /File.hpp"
100100 "${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"
103102 "${MEL_LOGGING_HEADERS_DIR} /Table.hpp"
104103 "${MEL_LOGGING_HEADERS_DIR} /Detail/Csv.inl"
105104 "${MEL_LOGGING_HEADERS_DIR} /Detail/StreamMeta.hpp"
@@ -289,7 +288,7 @@ list(APPEND MEL_LOGGING_SRC
289288 "${MEL_LOGGING_SRC_DIR} /Csv.cpp"
290289 "${MEL_LOGGING_SRC_DIR} /File.cpp"
291290 "${MEL_LOGGING_SRC_DIR} /Log.cpp"
292- "${MEL_LOGGING_SRC_DIR} /LogRecord .cpp"
291+ "${MEL_LOGGING_SRC_DIR} /LogUtil .cpp"
293292 "${MEL_LOGGING_SRC_DIR} /Table.cpp"
294293)
295294
Original file line number Diff line number Diff line change 1919
2020#include < MEL/Logging/Detail/StreamMeta.hpp>
2121#include < sys/stat.h>
22- #include < MEL/Logging/Severity.hpp>
2322#include < MEL/Core/Console.hpp>
2423#include < MEL/Utility/System.hpp>
2524#include < MEL/Core/Timestamp.hpp>
2625
2726namespace mel {
2827
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+
2969// / Encapsulates a Log record
3070class LogRecord {
3171public:
Original file line number Diff line number Diff line change 1717
1818#pragma once
1919
20- #include < MEL/Logging/LogRecord .hpp>
20+ #include < MEL/Logging/Detail/LogUtil .hpp>
2121#include < iomanip>
2222
2323namespace mel {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1717
1818#pragma once
1919
20- #include < MEL/Logging/LogRecord .hpp>
20+ #include < MEL/Logging/Detail/LogUtil .hpp>
2121
2222namespace mel {
2323
Original file line number Diff line number Diff line change 1- #include < MEL/Logging/LogRecord .hpp>
1+ #include < MEL/Logging/Detail/LogUtil .hpp>
22#include < cstring>
33
44namespace mel {
You can’t perform that action at this time.
0 commit comments