1616#include " LogIntermediate.hpp"
1717#include " LogLevel.hpp"
1818#include " LogMessage.hpp"
19+ #include " LogStream.hpp"
1920
2021namespace al
2122{
@@ -37,7 +38,7 @@ namespace al
3738 static void FlushQueue ();
3839
3940 protected:
40- static void PushMessage (const eLogLevel level, std::chrono::system_clock::time_point&& timestamp, std::source_location&& location, std::string&& message) noexcept ;
41+ static void PushMessage (const eLogLevel level, std::chrono::system_clock::time_point&& timestamp, std::source_location&& location, std::string&& message, std::optional<std::shared_ptr<LogStream> const >&& stream = std:: nullopt ) noexcept ;
4142
4243 private:
4344 void CallSinks (LogMessagePtr msgPtr);
@@ -70,7 +71,17 @@ namespace al
7071 template <typename ...Args>
7172 inline void LOGF (const eLogLevel level, LogIntermediate formatString, Args&&... formatArgs)
7273 {
73- auto capture = LogCapture (level, std::move (formatString.Location ()));
74+ auto capture = LogCapture (level, std::move (formatString.Location ()), std::nullopt );
75+ capture << VFORMAT (formatString.FormatString (), MAKE_FORMAT_ARGS (formatArgs...));
76+ }
77+
78+ template <typename ... Args>
79+ inline void LOGF (const std::shared_ptr<LogStream> stream, const eLogLevel level, LogIntermediate formatString, Args&&... formatArgs)
80+ {
81+ if (stream && !stream->Enabled ())
82+ return ;
83+
84+ auto capture = LogCapture (level, std::move (formatString.Location ()), stream);
7485 capture << VFORMAT (formatString.FormatString (), MAKE_FORMAT_ARGS (formatArgs...));
7586 }
7687}
0 commit comments