diff --git a/Include/Aurora/Logging/Logging.hpp b/Include/Aurora/Logging/Logging.hpp index 1c9ed7d9..e1dc7b0a 100644 --- a/Include/Aurora/Logging/Logging.hpp +++ b/Include/Aurora/Logging/Logging.hpp @@ -197,6 +197,66 @@ ADD_AU_GLOBAL_ALIAS(Game) ADD_AU_GLOBAL_ALIAS(Verbose) ADD_AU_GLOBAL_ALIAS(Critical) +#define AuLogWarnOnce(...) \ +{ \ + static __audetail::InitOnceABI gInitOnce; \ + if (Aurora::Threading::InitOnceLocker::TryLock(&gInitOnce)) \ + { \ + AuLogWarn(__VA_ARGS__); \ + Aurora::Threading::InitOnceLocker::Finish(&gInitOnce); \ + } \ +} + +#define AuLogInfoOnce(...) \ +{ \ + static __audetail::InitOnceABI gInitOnce; \ + if (Aurora::Threading::InitOnceLocker::TryLock(&gInitOnce)) \ + { \ + AuLogInfo(__VA_ARGS__); \ + Aurora::Threading::InitOnceLocker::Finish(&gInitOnce); \ + } \ +} + +#define AuLogDbgOnce(...) \ +{ \ + static __audetail::InitOnceABI gInitOnce; \ + if (Aurora::Threading::InitOnceLocker::TryLock(&gInitOnce)) \ + { \ + AuLogDbg(__VA_ARGS__); \ + Aurora::Threading::InitOnceLocker::Finish(&gInitOnce); \ + } \ +} + +#define AuLogErrorOnce(...) \ +{ \ + static __audetail::InitOnceABI gInitOnce; \ + if (Aurora::Threading::InitOnceLocker::TryLock(&gInitOnce)) \ + { \ + AuLogError(__VA_ARGS__); \ + Aurora::Threading::InitOnceLocker::Finish(&gInitOnce); \ + } \ +} + +#define AuLogVerboseOnce(...) \ +{ \ + static __audetail::InitOnceABI gInitOnce; \ + if (Aurora::Threading::InitOnceLocker::TryLock(&gInitOnce)) \ + { \ + AuLogVerbose(__VA_ARGS__); \ + Aurora::Threading::InitOnceLocker::Finish(&gInitOnce); \ + } \ +} + +#define AuLogCriticalOnce(...) \ +{ \ + static __audetail::InitOnceABI gInitOnce; \ + if (Aurora::Threading::InitOnceLocker::TryLock(&gInitOnce)) \ + { \ + AuLogCritical(__VA_ARGS__); \ + Aurora::Threading::InitOnceLocker::Finish(&gInitOnce); \ + } \ +} + #if defined(STAGING) || defined(DEBUG) ADD_AU_GLOBAL_ALIAS(VerboseNoShip) #else diff --git a/Include/Aurora/Logging/Sinks.hpp b/Include/Aurora/Logging/Sinks.hpp index 4a25e7ce..1f7d6ff8 100644 --- a/Include/Aurora/Logging/Sinks.hpp +++ b/Include/Aurora/Logging/Sinks.hpp @@ -36,7 +36,7 @@ namespace Aurora::Logging AUKN_SHARED_API(NewOSEventDirectorySink, IBasicSink); /** - * @brief Constructs a new sink backed by, syslog or eventlog, by name or event source respectively + * @brief Constructs a new sink backed by syslog or eventlog, by name or event source respectively */ AUKN_SHARED_API(NewOSNamedEventDirectorySink, IBasicSink, const AuString &name); @@ -45,20 +45,20 @@ namespace Aurora::Logging */ AUKN_SHARED_API(NewDebugLogger, IBasicSink); - /** - * @brief Constructs a text of binary log file sink + /*s* + * @brief Constructs a sink of a human-readable text or binary log file */ - AUKN_SHARED_API(NewFileSink, IFormattedSink, const AuString &path, bool binary = false); + AUKN_SHARED_API(NewFileSink, IFormattedSink, const AuString &path, bool bBinary = false); /** * @brief Constructs a dedicated log directory subject to erasure as defined by defined DirectoryLogger */ - AUKN_SHARED_API(NewDirectorySink, IBasicSink, const AuString &path, DirectoryLogger dirInfo, bool binary = false); + AUKN_SHARED_API(NewDirectorySink, IBasicSink, const AuString &path, DirectoryLogger dirInfo, bool bBinary = false); /** * @brief */ - AUKN_SHARED_API(NewIPCSink, IIPCLogger, const AuString &path, bool lengthPrefixedStream = false); + AUKN_SHARED_API(NewIPCSink, IIPCLogger, const AuString &path, bool bLengthPrefixedStream = false); /** * @brief Constructs an in-memory ring buffer sink