mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
Avoid using map for Logger::MessageSeverity
This commit is contained in:
parent
195020df46
commit
7592a48587
@ -38,12 +38,7 @@ void Logger::verbose(const std::string& component, const std::string& message) {
|
||||
log(component, Logger::Verbose, message);
|
||||
}
|
||||
|
||||
std::map<Logger::MessageSeverity, char> severityStr{{Logger::Error, 'E'},
|
||||
{Logger::Warning, 'W'},
|
||||
{Logger::Info, 'I'},
|
||||
{Logger::Verbose, 'V'}};
|
||||
|
||||
void StdOutReceiver::messageReceived(const Logger::LogMessage& message) {
|
||||
std::cout << severityStr[message.severity] << " [" << message.component
|
||||
<< "] " << message.message << '\n';
|
||||
std::cout << Logger::messageSeverityName[message.severity] << " ["
|
||||
<< message.component << "] " << message.message << '\n';
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef _RWENGINE_LOGGER_HPP_
|
||||
#define _RWENGINE_LOGGER_HPP_
|
||||
|
||||
#include <array>
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -13,7 +14,8 @@
|
||||
*/
|
||||
class Logger {
|
||||
public:
|
||||
enum MessageSeverity { Verbose, Info, Warning, Error };
|
||||
enum MessageSeverity { Verbose = 0, Info, Warning, Error};
|
||||
static constexpr std::array<char, 4> messageSeverityName{{'V', 'I', 'W', 'E'}};
|
||||
|
||||
struct LogMessage {
|
||||
/// The component that produced the message
|
||||
|
Loading…
Reference in New Issue
Block a user