Cogs.Core
RedirectedLogger.h
1#pragma once
2
3#include "Consumer.h"
4#include "LogManager.h"
5
6namespace Cogs::Logging {
13 class COGSFOUNDATION_API RedirectedLogger : public Consumer {
14 public:
15 void setLoggerCallback(LoggerCallback* callback) { loggerCallback = callback; }
16 void setFileLineLoggerCallback(FileLineLoggerCallback* callback) { fileLineLoggerCallback = callback; }
17
18 LoggerCallback* getLoggerCallback() { return loggerCallback; }
19 FileLineLoggerCallback* getFileLineLoggerCallback() { return fileLineLoggerCallback; }
20
21 private:
22 LoggerCallback* loggerCallback = nullptr;
23 FileLineLoggerCallback* fileLineLoggerCallback = nullptr;
24
25 virtual void consumeMessage(const char* source, Category category, uint32_t errorNumber, const char* message, const char* filename, int lineNumber) override;
26 };
27}
Consumer is the base class for objects that want to consume log messages through the LogManager.
Definition: Consumer.h:18
RedirectedLogger is a message consumer that forwards any incoming message to the callback functions r...
Contains logging functionality for the Cogs native library.
void(const char *message, const char *source, int category) LoggerCallback
Definition of logging callback.
Definition: LogManager.h:22
void consumeMessage(const char *source, Category category, uint32_t errorNumber, const char *filename, int lineNumber, _Printf_format_string_ const char *fmt, va_list argptr)
Forwards the incoming log message to all interested consumers.
Definition: LogManager.cpp:49
void(const char *file, int line, const char *message, const char *source, int category) FileLineLoggerCallback
Definition of logging callback including file and line information.
Definition: LogManager.h:25
Category
Logging categories used to filter log messages.
Definition: LogManager.h:31