52 #define LOGLEVEL_TO_MASKLEVEL(x) (1 << x)
81 const std::string &time,
const std::string &thread_name,
82 const std::string &payload_text);
101 const std::string &time,
const std::string &thread_name,
102 const std::string &payload_text) = 0;
108 const std::string &time,
const std::string &thread_name,
109 const std::string &payload_text)
121 is_tty = isatty(fileno(stdout));
136 void setFile(
const std::string &filename, s64 file_size_max);
166 m_buffer = std::queue<std::string>();
209 #define TRACEDO(x) do { \
210 if (g_logger.getTraceEnabled()) { \
215 #define TRACESTREAM(x) TRACEDO(verbosestream x)
217 #define dout_con (*dout_con_ptr)
218 #define derr_con (*derr_con_ptr)
void logRaw(LogLevel lev, const std::string &line)
Definition: log.h:138
void setFile(const std::string &filename, s64 file_size_max)
Definition: log.cpp:305
std::ofstream m_stream
Definition: log.h:144
void log(LogLevel lev, const std::string &combined, const std::string &time, const std::string &thread_name, const std::string &payload_text)
Definition: log.h:107
virtual void logRaw(LogLevel, const std::string &line)=0
virtual void log(LogLevel, const std::string &combined, const std::string &time, const std::string &thread_name, const std::string &payload_text)=0
LogOutputBuffer(Logger &logger)
Definition: log.h:149
std::string get()
Definition: log.h:174
bool empty() const
Definition: log.h:169
virtual ~LogOutputBuffer()
Definition: log.h:155
void logRaw(LogLevel lev, const std::string &line)
Definition: log.cpp:383
Logger & m_logger
Definition: log.h:185
std::queue< std::string > m_buffer
Definition: log.h:184
void updateLogLevel()
Definition: log.cpp:369
void clear()
Definition: log.h:164
void addOutputMasked(ILogOutput *out, LogLevelMask mask)
Definition: log.cpp:181
static LogColor color_mode
Definition: log.h:76
void registerThread(const std::string &name)
Definition: log.cpp:216
std::mutex m_mutex
Definition: log.h:93
std::vector< ILogOutput * > m_outputs[LL_MAX]
Definition: log.h:86
void logToOutputs(LogLevel, const std::string &combined, const std::string &time, const std::string &thread_name, const std::string &payload_text)
Definition: log.cpp:291
void deregisterThread()
Definition: log.cpp:223
static const std::string getLevelLabel(LogLevel lev)
Definition: log.cpp:230
void logToOutputsRaw(LogLevel, const std::string &line)
Definition: log.cpp:284
volatile bool m_silenced_levels[LL_MAX]
Definition: log.h:91
void setLevelSilenced(LogLevel lev, bool silenced)
Definition: log.cpp:211
bool m_trace_enabled
Definition: log.h:94
void logRaw(LogLevel lev, const std::string &text)
Definition: log.cpp:276
LogLevelMask removeOutput(ILogOutput *out)
Definition: log.cpp:196
void addOutput(ILogOutput *out)
Definition: log.cpp:171
const std::string getThreadName()
Definition: log.cpp:248
void setTraceEnabled(bool enable)
Definition: log.h:70
void log(LogLevel lev, const std::string &text)
Definition: log.cpp:262
bool getTraceEnabled()
Definition: log.h:71
std::map< std::thread::id, std::string > m_thread_names
Definition: log.h:92
static LogLevel stringToLevel(const std::string &name)
Definition: log.cpp:153
void addOutputMaxLevel(ILogOutput *out, LogLevel lev)
Definition: log.cpp:189
void logRaw(LogLevel lev, const std::string &line)
Definition: log.cpp:333
StreamLogOutput(std::ostream &stream)
Definition: log.h:117
bool is_tty
Definition: log.h:131
std::ostream & m_stream
Definition: log.h:130
StreamLogOutput stderr_output
std::ostream * dout_con_ptr
Definition: log.cpp:97
StreamLogOutput stdout_output
std::ostream verbosestream
Logger g_logger
Definition: log.cpp:81
std::ostream actionstream
std::ostream warningstream
LogColor
Definition: log.h:45
@ LOG_COLOR_NEVER
Definition: log.h:46
@ LOG_COLOR_AUTO
Definition: log.h:48
@ LOG_COLOR_ALWAYS
Definition: log.h:47
std::ostream * derr_con_ptr
Definition: log.cpp:98
LogLevel
Definition: log.h:35
@ LL_INFO
Definition: log.h:40
@ LL_ERROR
Definition: log.h:37
@ LL_NONE
Definition: log.h:36
@ LL_WARNING
Definition: log.h:38
@ LL_ACTION
Definition: log.h:39
@ LL_MAX
Definition: log.h:42
@ LL_VERBOSE
Definition: log.h:41
std::ostream * derr_server_ptr
u8 LogLevelMask
Definition: log.h:51