Skip to content

Commit

Permalink
move files out of main Logging dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew E Pezent committed Feb 26, 2019
1 parent 1eb7bf2 commit 6e5cb46
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 69 deletions.
5 changes: 2 additions & 3 deletions cmake/MELSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ list(APPEND MEL_LOGGING_HEADERS
"${MEL_LOGGING_HEADERS_DIR}/Csv.hpp"
"${MEL_LOGGING_HEADERS_DIR}/File.hpp"
"${MEL_LOGGING_HEADERS_DIR}/Log.hpp"
"${MEL_LOGGING_HEADERS_DIR}/LogRecord.hpp"
"${MEL_LOGGING_HEADERS_DIR}/Severity.hpp"
"${MEL_LOGGING_HEADERS_DIR}/Detail/LogUtil.hpp"
"${MEL_LOGGING_HEADERS_DIR}/Table.hpp"
"${MEL_LOGGING_HEADERS_DIR}/Detail/Csv.inl"
"${MEL_LOGGING_HEADERS_DIR}/Detail/StreamMeta.hpp"
Expand Down Expand Up @@ -289,7 +288,7 @@ list(APPEND MEL_LOGGING_SRC
"${MEL_LOGGING_SRC_DIR}/Csv.cpp"
"${MEL_LOGGING_SRC_DIR}/File.cpp"
"${MEL_LOGGING_SRC_DIR}/Log.cpp"
"${MEL_LOGGING_SRC_DIR}/LogRecord.cpp"
"${MEL_LOGGING_SRC_DIR}/LogUtil.cpp"
"${MEL_LOGGING_SRC_DIR}/Table.cpp"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,53 @@

#include <MEL/Logging/Detail/StreamMeta.hpp>
#include <sys/stat.h>
#include <MEL/Logging/Severity.hpp>
#include <MEL/Core/Console.hpp>
#include <MEL/Utility/System.hpp>
#include <MEL/Core/Timestamp.hpp>

namespace mel {

/// Represents a logging severity level
enum Severity {
None = 0, ///< always written
Fatal = 1, ///< error that forces application abort
Error = 2, ///< error that is fatal to operation, but not application
Warning = 3, ///< error that may cause issues, but has been accounted for
Info = 4, ///< useful information needed during normal operation
Verbose = 5, ///< useful information not needed during normal operation
Debug = 6, ///< useful information needed for diagnostics
};

inline const char* severity_to_string(Severity severity) {
switch (severity) {
case Fatal:
return "FATAL";
case Error:
return "ERROR";
case Warning:
return "WARN";
case Info:
return "INFO";
case Verbose:
return "VERB";
case Debug:
return "DEBUG";
default:
return "NONE";
}
}

inline Severity string_to_severity(const char* str) {
for (Severity severity = Fatal; severity <= Debug;
severity = static_cast<Severity>(severity + 1)) {
if (severity_to_string(severity)[0] == str[0]) {
return severity;
}
}

return None;
}

/// Encapsulates a Log record
class LogRecord {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/MEL/Logging/Formatters/TxtFormatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <MEL/Logging/LogRecord.hpp>
#include <MEL/Logging/Detail/LogUtil.hpp>
#include <iomanip>

namespace mel {
Expand Down
62 changes: 0 additions & 62 deletions include/MEL/Logging/Severity.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion include/MEL/Logging/Writers/Writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <MEL/Logging/LogRecord.hpp>
#include <MEL/Logging/Detail/LogUtil.hpp>

namespace mel {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <MEL/Logging/LogRecord.hpp>
#include <MEL/Logging/Detail/LogUtil.hpp>
#include <cstring>

namespace mel {
Expand Down

0 comments on commit 6e5cb46

Please sign in to comment.