3#include "../StringView.h"
8 #define VALIDATE_ARGS(a)
10 #define _Printf_format_string_
11 #define VALIDATE_ARGS(a) __attribute__((format(printf, a, a+1)))
22 using LoggerCallback = void(
const char* message,
const char* source,
int category);
25 using FileLineLoggerCallback = void(
const char* file,
int line,
const char* message,
const char* source,
int category);
52 FirstFoundation = 0x00100000,
53 FoundationIO = 0x00110000,
54 FoundationModule = 0x00120000,
55 FoundationNetwork = 0x00130000,
58 FirstRendering = 0x01000000,
61 FirstCore = 0x10000000,
64 FirstDesktop = 0x20000000,
67 FirstTerrain = 0x30000000,
70 FirstCoreExtension = 0x40000000,
74 FirstExternalExtension = 0x90000000,
77 FirstThirdParty = 0xB0000000,
83 FirstApplication = 0xC0000000,
116 void COGSFOUNDATION_API log(
const char* message,
const char* source,
const Category category, uint32_t errorNumber);
119 void COGSFOUNDATION_API log(
const char* source,
const Category category, uint32_t errorNumber, _Printf_format_string_
const char * fmt, ...) VALIDATE_ARGS(4);
122 void COGSFOUNDATION_API
logFileLine(const
char* file, const
int line, const
char* source, const
Category category, uint32_t errorNumber, _Printf_format_string_ const
char * fmt, ...) VALIDATE_ARGS(6);
125 void COGSFOUNDATION_API
logArgs(const
char* source, const
Category category, uint32_t errorNumber, const
char * fmt, va_list args);
128 void COGSFOUNDATION_API
logFileLineArgs(const
char* file, const
int line, const
char * source, const
Category category, uint32_t errorNumber, const
char * fmt, va_list args);
139 class COGSFOUNDATION_API
Log
145 constexpr explicit Log(
const char(&n)[LEN]) noexcept : literalName(n) {}
148 void logFileLine(
const char* file,
const int line,
const Category category, uint32_t errorNumber, _Printf_format_string_
const char * fmt, ...) const VALIDATE_ARGS(6)
151 va_start(argptr, fmt);
157 void log(
const Category category, uint32_t errorNumber, _Printf_format_string_
const char * fmt, ...) const VALIDATE_ARGS(4)
160 va_start(argptr, fmt);
165 [[nodiscard]]
constexpr const char* getName() const noexcept {
172 const char* literalName =
nullptr;
Log implementation class.
void logFileLine(const char *file, const int line, const Category category, uint32_t errorNumber, _Printf_format_string_ const char *fmt,...) const VALIDATE_ARGS(6)
Log a formatted message with file/line information.
constexpr Log(const char(&n)[LEN]) noexcept
Log()=default
Default constructor available to dervied types.
void log(const Category category, uint32_t errorNumber, _Printf_format_string_ const char *fmt,...) const VALIDATE_ARGS(4)
Log a formatted message.
Provides a weakly referenced view over the contents of a string.
void COGSFOUNDATION_API enableUnhandledExceptionLogging()
Enable catching and logging of hardware exceptions (crashes) before exiting. (Windows only - for now....
void COGSFOUNDATION_API registerConsumer(Consumer *consumer)
Registers the specified consumer with the LogManager.
void COGSFOUNDATION_API logFileLineArgs(const char *file, const int line, const char *source, const Category category, uint32_t errorNumber, const char *fmt, va_list args)
Log the given formatted string with argument list and file/line information.
constexpr Log getLogger(const char(&name)[LEN]) noexcept
void(const char *message, const char *source, int category) LoggerCallback
Definition of logging callback.
Category COGSFOUNDATION_API parseCategoryString(const StringView category)
Utility function that takes a loglevel name as a string and returns the corresponding log level enum ...
void COGSFOUNDATION_API logFileLine(const char *file, const int line, const char *source, const Category category, uint32_t errorNumber, _Printf_format_string_ const char *fmt,...) VALIDATE_ARGS(6)
Logs the given formatted string (using printf formatting rules) with file/line information and source...
bool COGSFOUNDATION_API isErrorGroup(uint32_t errorNumber, ErrorGroup group)
Tests whether the specified error number is from the given group.
void COGSFOUNDATION_API updateLoggerCategory(Category category)
void COGSFOUNDATION_API setLoggerCategory(Category category)
Sets the default category level for loggers created after this call.
ErrorGroup
ErrorGroup values define the top 16-bits of module specific error numbers.
@ NvidiaNvEnc
Error values from NvEnc are in this group.
@ Unspecified
The default error number for legacy logger usage.
@ NvidiaCUDA
CUDA errors are wrapped in this group.
@ LibSRT
LibSRT doesn't define error numbers, so all SRT errors will be assigned this value.
void(const char *file, int line, const char *message, const char *source, int category) FileLineLoggerCallback
Definition of logging callback including file and line information.
void COGSFOUNDATION_API logArgs(const char *source, const Category category, uint32_t errorNumber, const char *fmt, va_list args)
Log the given formatted string with argument list.
Category
Logging categories used to filter log messages.
void updateMinimumCategory()
Internal.
void COGSFOUNDATION_API unregisterConsumer(Consumer *consumer)
Removes the specified consumer from the LogManager.
Contains all Cogs related functionality.
@ Debug
If available, the device will operate in debug mode, performing additional validation of input data,...