SA_Logger
Sapphire's Suite's C++ Logger.
Loading...
Searching...
No Matches
LoggerBase.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Sapphire's Suite. All Rights Reserved.
2
3#pragma once
4
5#ifndef SAPPHIRE_LOGGER_LOGGER_BASE_GUARD
6#define SAPPHIRE_LOGGER_LOGGER_BASE_GUARD
7
8#include <list>
9
12
23namespace SA
24{
29 {
30 protected:
31
32 //{ Streams
33
35 std::list<ALogStream*> mStreams;
36
43 virtual void ProcessLog(const SA::Log& _log, bool _bForce = false);
44
50 virtual void RegisterStream(ALogStream* _stream);
51
59 virtual bool UnregisterStream(ALogStream* _stream);
60
61 //}
62
63 public:
68 virtual ~LoggerBase();
69
75 virtual void Log(SA::Log _log);
76
86 template <typename ExcepT>
87 void Assert(ExcepT _exc);
88
89
90 //{ Streams
91
101 template <typename StreamT, typename... Args>
102 StreamT& CreateSteam(Args&&... _args);
103
113 template <typename StreamT>
114 bool DestroyStream(StreamT& _stream, bool _bFlush = true);
115
116
122 virtual void ClearStreams(bool _bFlush = true);
123
124
128 virtual void Flush();
129
130
136 virtual void EnableLogLevel(LogLevel _level);
137
143 virtual void DisableLogLevel(LogLevel _level);
144
145
151 virtual void EnableLogChannel(const std::wstring& _channel);
152
158 virtual void DisableLogChannel(const std::wstring& _channel);
159
160 //}
161
162
163 //{ Frame Num
164
166 virtual void IncrementFrameNum() = 0;
167
169 virtual uint32_t GetFrameNum() const = 0;
170
171 //}
172 };
173}
174
175#include <SA/Logger/LoggerBase.inl>
176
177
180#endif // SAPPHIRE_LOGGER_LOGGER_BASE_GUARD
Log base stream implementation.
Default Exception type implementation.
LogLevel
All levels of logging.
Definition LogLevel.hpp:26
Abstract log stream class.
Definition ALogStream.hpp:27
Log type implementation.
Definition Log.hpp:25
Logger base class implementation.
Definition LoggerBase.hpp:29
virtual void DisableLogLevel(LogLevel _level)
Disable LogLevel for all registered streams.
virtual bool UnregisterStream(ALogStream *_stream)
Unregister a stream from output.
virtual void ProcessLog(const SA::Log &_log, bool _bForce=false)
Process log to output.
virtual void DisableLogChannel(const std::wstring &_channel)
Disable LogChannel for all registered streams.
void Assert(ExcepT _exc)
Process exception.
virtual void RegisterStream(ALogStream *_stream)
Register a stream to output.
virtual void EnableLogChannel(const std::wstring &_channel)
Enable LogChannel for all registered streams.
virtual void IncrementFrameNum()=0
Increment current registered frame number.
virtual ~LoggerBase()
Destructor Destroy all created log streams.
virtual void Log(SA::Log _log)
Push a new log in logger.
virtual void Flush()
Force logger to flush all streams.
virtual void EnableLogLevel(LogLevel _level)
Enable LogLevel for all registered streams.
bool DestroyStream(StreamT &_stream, bool _bFlush=true)
Destroy a previously created stream.
virtual uint32_t GetFrameNum() const =0
Get current registered frame number.
StreamT & CreateSteam(Args &&... _args)
Create a new stream to output in.
virtual void ClearStreams(bool _bFlush=true)
std::list< ALogStream * > mStreams
Registered output streams.
Definition LoggerBase.hpp:35