Cogs.Core
Consumer.h
1#pragma once
2
3#include "../Platform/Threads.h"
4
5namespace Cogs {
6
7 namespace Logging {
8 enum class Category;
9
18 class COGSFOUNDATION_API Consumer {
19 public:
20 Consumer();
21 virtual ~Consumer();
22
23 virtual void consumeMessage(const char* source, Category category, uint32_t errorNumber, const char* message, const char* filename, int lineNumber) = 0;
24
25 Category getMinimumCategory() const { return minimumCategory; }
26 void setMinimumCategory(Category category);
27
28 void enableFilenames(bool enable) { outputFilenames = enable; }
29
31 static void setDefaultMinimumCategory(Category category);
32
33 static const char* getCategoryName(Category category);
34
35 static const char* getCategoryNameColor(Category category);
36
37 protected:
38 Mutex mutex;
39 bool outputFilenames = false;
40
41 private:
42 Category minimumCategory;
43 static Category defaultMinimumCategory;
44 };
45 }
46}
Consumer is the base class for objects that want to consume log messages through the LogManager.
Definition: Consumer.h:18
Mutex mutex
Mutex available for implementations to use if needed.
Definition: Consumer.h:38
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
Category
Logging categories used to filter log messages.
Definition: LogManager.h:31
Contains all Cogs related functionality.
Definition: FieldSetter.h:23