CG_Labs 2026.1
Loading...
Searching...
No Matches
Log.h File Reference
#include "BuildSettings.h"
#include <cstddef>
#include <cstdarg>

Go to the source code of this file.

Namespaces

namespace  Log

Macros

#define SUCCESS(r)
#define FAILURE(r)
#define Assert(m)
#define Param(m)
#define LOG_MESSAGE_ONCE_FLAG   1
#define LOG_LOCATION_ONCE_FLAG   2
#define LOG_OUT_STD   (1 << 0)
#define LOG_OUT_FILE   (1 << 1)
#define LOG_OUT_CUSTOM   (1 << 15)
#define Log(m, ...)
#define LogType(t, m, ...)
#define LogMsgOnce(t, m, ...)
#define LogLocOnce(t, m, ...)
#define LogWarning(m, ...)
#define LogError(m, ...)
#define LogFile(m, ...)
#define LogInfo(m, ...)
#define LogTrivia(m, ...)

Enumerations

enum  Log::Type {
  Log::TYPE_SUCCESS = 0 , Log::TYPE_INFO = 1 , Log::TYPE_NEUTRAL = 2 , Log::TYPE_WARNING = 3 ,
  Log::TYPE_ERROR = 4 , Log::TYPE_FILE = 5 , Log::TYPE_ASSERT = 6 , Log::TYPE_PARAM = 7 ,
  Log::TYPE_TRIVIA = 8 , Log::N_TYPES = 9
}
enum  Log::Severity { Log::OK = 0 , Log::BAD , Log::TERMINAL }
enum  Log::Verbosity { Log::WHISPER = 0 , Log::LOUD_UNSITUATED , Log::LOUD }

Functions

void Log::Init ()
void Log::Destroy ()
void Log::SetCustomOutputTargetFunc (void(*textout)(Type, const char *))
void Log::SetOutputTargets (std::size_t targets)
void Log::SetVerbosity (Type type, Verbosity verbosity)
void Log::SetIncludeThreadID (bool inc)
void Log::Report (unsigned int flags, const char *file, const char *function, int line, Type type, const char *str,...)
bool Log::ReportParam (unsigned int test, const char *file, const char *function, int line)

Macro Definition Documentation

◆ Assert

#define Assert ( m)
Value:
if (!(static_cast<unsigned int>(m))) Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_ASSERT, "Assertion failed at line %u in file %s.", __LINE__, __FILE__)

◆ FAILURE

#define FAILURE ( r)
Value:
(!SUCCESS(r))
#define SUCCESS(r)
Definition Log.h:14

◆ Log

#define Log ( m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_NEUTRAL, static_cast<char const*>(m), ##__VA_ARGS__)

◆ LOG_LOCATION_ONCE_FLAG

#define LOG_LOCATION_ONCE_FLAG   2

◆ LOG_MESSAGE_ONCE_FLAG

#define LOG_MESSAGE_ONCE_FLAG   1

◆ LOG_OUT_CUSTOM

#define LOG_OUT_CUSTOM   (1 << 15)

◆ LOG_OUT_FILE

#define LOG_OUT_FILE   (1 << 1)

◆ LOG_OUT_STD

#define LOG_OUT_STD   (1 << 0)

◆ LogError

#define LogError ( m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_ERROR, static_cast<char const*>(m), ##__VA_ARGS__)

◆ LogFile

#define LogFile ( m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_FILE, static_cast<char const*>(m), ##__VA_ARGS__)

◆ LogInfo

#define LogInfo ( m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_INFO, static_cast<char const*>(m), ##__VA_ARGS__)

◆ LogLocOnce

#define LogLocOnce ( t,
m,
... )
Value:
Log::Report(LOG_LOCATION_ONCE_FLAG, __FILE__, __FUNCTION__, __LINE__, t, static_cast<char const*>(m), ##__VA_ARGS__)
#define LOG_LOCATION_ONCE_FLAG
Definition Log.h:30

◆ LogMsgOnce

#define LogMsgOnce ( t,
m,
... )
Value:
Log::Report(LOG_MESSAGE_ONCE_FLAG, __FILE__, __FUNCTION__, __LINE__, t, static_cast<char const*>(m), ##__VA_ARGS__)
#define LOG_MESSAGE_ONCE_FLAG
Definition Log.h:29

◆ LogTrivia

#define LogTrivia ( m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_TRIVIA, static_cast<char const*>(m), ##__VA_ARGS__)

◆ LogType

#define LogType ( t,
m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, t, static_cast<char const*>(m), ##__VA_ARGS__)

◆ LogWarning

#define LogWarning ( m,
... )
Value:
Log::Report(0, __FILE__, __FUNCTION__, __LINE__, Log::Type::TYPE_WARNING, static_cast<char const*>(m), ##__VA_ARGS__)

◆ Param

#define Param ( m)
Value:
Log::ReportParam(static_cast<unsigned int>(m), __FILE__, __FUNCTION__, __LINE__)

◆ SUCCESS

#define SUCCESS ( r)
Value:
((r) == RESULT_SUCCESS)