[+] AuLogWarnOnce

[+] AuLogInfoOnce
[+] AuLogDbgOnce
[+] AuLogErrorOnce
[+] AuLogVerboseOnce
This commit is contained in:
Reece Wilson 2023-11-29 04:31:55 +00:00
parent ed823a9819
commit 541f12acfb
2 changed files with 66 additions and 6 deletions

View File

@ -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

View File

@ -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