6#ifndef ATLAS_LOGGING_HPP
7#define ATLAS_LOGGING_HPP
12#include <source_location>
32 std::string
formatSourceLocation(
const std::source_location loc,
const format_ns::string_view msg );
37 void logDebug(
const std::string_view );
38 void logInfo(
const std::string_view );
39 void logWarn(
const std::string_view );
40 void logError(
const std::string_view );
44 template <
typename... Ts >
48 const format_ns::format_string< Ts... > format_string,
50 const std::source_location& source_location = std::source_location::current() )
52 if constexpr (
sizeof...( Ts ) > 0 )
54 const std::string user_message { format_ns::format( format_string, std::forward< Ts >( ts )... ) };
68 template <
typename... Ts >
69 debug( format_ns::format_string< Ts... >, Ts&&... ) ->
debug< Ts... >;
71 template <
typename... Ts >
75 const format_ns::format_string< Ts... > format_string,
77 [[maybe_unused]]
const std::source_location& source_location = std::source_location::current() )
79 const std::string user_message { format_ns::format( format_string, std::forward< Ts >( ts )... ) };
89 template <
typename... Ts >
90 info( format_ns::format_string< Ts... >, Ts&&... ) ->
info< Ts... >;
92 template <
typename... Ts >
96 const format_ns::format_string< Ts... > format_string,
98 const std::source_location& source_location = std::source_location::current() )
100 if constexpr (
sizeof...( Ts ) > 0 )
102 const std::string user_message { format_ns::format( format_string, std::forward< Ts >( ts )... ) };
108 format_ns::format( format_string, std::forward< Ts >( ts )... ),
114 const std::string full_message {
formatSourceLocation( source_location, format_string.get() ) };
124 template <
typename... Ts >
125 warn( format_ns::format_string< Ts... >, Ts&&... ) ->
warn< Ts... >;
127 template <
typename... Ts >
131 const format_ns::format_string< Ts... > body,
133 const std::source_location& loc = std::source_location::current() )
135 if constexpr (
sizeof...( Ts ) > 0 )
137 const std::string user_message { format_ns::format( body, std::forward< Ts >( ts )... ) };
143 format_ns::format( body, std::forward< Ts >( ts )... ),
158 template <
typename... Ts >
159 error( format_ns::format_string< Ts... >, Ts&&... a ) ->
error< Ts... >;
161 template <
typename... Ts >
164 errorLoc(
const format_ns::format_string< Ts... > format_string,
const std::source_location& loc, Ts&... ts )
166 if constexpr (
sizeof...( Ts ) > 0 )
168 const std::string user_message { format_ns::format( format_string, std::forward< Ts >( ts )... ) };
174 format_ns::format( format_string, std::forward< Ts >( ts )... ),
189 template <
typename... Ts >
190 errorLoc( format_ns::format_string< Ts... >,
const std::source_location&, Ts&&... a ) ->
errorLoc< Ts... >;
192 template <
typename... Ts >
196 const format_ns::format_string< Ts... > format_string,
198 const std::source_location& loc = std::source_location::current() )
200 if constexpr (
sizeof...( Ts ) > 0 )
202 const std::string user_message { format_ns::format( format_string, std::forward< Ts >( ts )... ) };
208 format_ns::format( format_string, std::forward< Ts >( ts )... ),
224 template <
typename... Ts >
@ ATLAS_CRITICAL
Definition MessageNotification.hpp:27
@ ATLAS_WARNING
Definition MessageNotification.hpp:25
@ ATLAS_INFO
Definition MessageNotification.hpp:24
@ ATLAS_ERROR
Definition MessageNotification.hpp:26
void logError(const std::string_view)
Passes message to spdlog.
Definition spdlogHelpers.cpp:51
void logInfo(const std::string_view)
Passes message to spdlog.
Definition spdlogHelpers.cpp:34
void logCritical(const std::string_view)
Passes message to spdlog.
Definition spdlogHelpers.cpp:60
void logWarn(const std::string_view)
Passes message to spdlog.
Definition spdlogHelpers.cpp:42
void logDebug(const std::string_view)
Passes message to spdlog.
Definition spdlogHelpers.cpp:28
Definition logging.cpp:37
warn(format_ns::format_string< Ts... >, Ts &&...) -> warn< Ts... >
void setFormat()
Definition logging.cpp:76
info(format_ns::format_string< Ts... >, Ts &&...) -> info< Ts... >
std::string formatSourceLocation(const std::source_location loc, const format_ns::string_view msg)
Definition logging.cpp:81
debug(format_ns::format_string< Ts... >, Ts &&...) -> debug< Ts... >
errorLoc(format_ns::format_string< Ts... >, const std::source_location &, Ts &&... a) -> errorLoc< Ts... >
critical(format_ns::format_string< Ts... >, Ts &&...) -> critical< Ts... >
void init()
Definition logging.cpp:38
void initGUIHooks()
Loads the GUI hooks required for some warnings to display to the user.
error(format_ns::format_string< Ts... >, Ts &&... a) -> error< Ts... >
void createMessage(QString user_message, QString full_message, const MessageLevel level)
Definition notifications.cpp:36
bool isNotificationsReady()
Definition notifications.cpp:81
Definition Database.cpp:17
Definition logging.hpp:194
critical(const format_ns::format_string< Ts... > format_string, Ts &&... ts, const std::source_location &loc=std::source_location::current())
Definition logging.hpp:195
Definition logging.hpp:46
debug(const format_ns::format_string< Ts... > format_string, Ts &&... ts, const std::source_location &source_location=std::source_location::current())
Definition logging.hpp:47
Definition logging.hpp:163
errorLoc(const format_ns::format_string< Ts... > format_string, const std::source_location &loc, Ts &... ts)
Definition logging.hpp:164
Definition logging.hpp:129
error(const format_ns::format_string< Ts... > body, Ts &&... ts, const std::source_location &loc=std::source_location::current())
Definition logging.hpp:130
Definition logging.hpp:73
info(const format_ns::format_string< Ts... > format_string, Ts &&... ts, const std::source_location &source_location=std::source_location::current())
Definition logging.hpp:74
Definition logging.hpp:94
warn(const format_ns::format_string< Ts... > format_string, Ts &&... ts, const std::source_location &source_location=std::source_location::current())
Definition logging.hpp:95