CG_Labs  2021.2
Classes | Enumerations | Functions | Variables
Log Namespace Reference

Classes

struct  LogSettings
 
class  View
 

Enumerations

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

Functions

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

Variables

FILE * logfile = nullptr
 
void(* textout_func )(Type, const char *) = nullptr
 
std::unordered_map< size_t, size_t > once_map
 
size_t output_targets = LOG_OUT_STD | LOG_OUT_CUSTOM | LOG_OUT_FILE
 
std::mutex fileMutex
 
char log_result_string [RESULT_MAX_STRING_LENGTH]
 
bool logIncludeThreadID = false
 
LogSettings logSettings []
 

Enumeration Type Documentation

◆ Severity

Enumerator
OK 
BAD 
TERMINAL 

◆ Type

enum Log::Type
Enumerator
TYPE_SUCCESS 
TYPE_INFO 
TYPE_NEUTRAL 
TYPE_WARNING 
TYPE_ERROR 
TYPE_FILE 
TYPE_ASSERT 
TYPE_PARAM 
TYPE_TRIVIA 
N_TYPES 

◆ Verbosity

Enumerator
WHISPER 
LOUD_UNSITUATED 
LOUD 

Function Documentation

◆ Destroy()

void Log::Destroy ( )

◆ Init()

void Log::Init ( )

◆ Report()

void Log::Report ( unsigned int  flags,
const char *  file,
const char *  function,
int  line,
Type  type,
const char *  str,
  ... 
)

Report a result to a log file and standard output

◆ ReportParam()

bool Log::ReportParam ( unsigned int  test,
const char *  file,
const char *  function,
int  line 
)

◆ SetCustomOutputTargetFunc()

void Log::SetCustomOutputTargetFunc ( void(*)(Type, const char *)  textout)

◆ SetIncludeThreadID()

void Log::SetIncludeThreadID ( bool  inc)

◆ SetOutputTargets() [1/2]

void Log::SetOutputTargets ( size_t  flags)

◆ SetOutputTargets() [2/2]

void Log::SetOutputTargets ( std::size_t  targets)

◆ SetVerbosity()

void Log::SetVerbosity ( Type  type,
Verbosity  verbosity 
)

Variable Documentation

◆ fileMutex

std::mutex Log::fileMutex

◆ log_result_string

char Log::log_result_string[RESULT_MAX_STRING_LENGTH]

◆ logfile

FILE* Log::logfile = nullptr

◆ logIncludeThreadID

bool Log::logIncludeThreadID = false

◆ logSettings

LogSettings Log::logSettings[]
Initial value:
= {
{ TYPE_SUCCESS , "Success: " , LOUD_UNSITUATED , OK },
{ TYPE_WARNING , "Warning: " , LOUD , OK },
{ TYPE_ERROR , "Error: " , LOUD , BAD },
{ TYPE_ASSERT , "Assert: " , LOUD , BAD },
{ TYPE_PARAM , "Parameter error: " , LOUD , BAD },
}
@ LOUD
Definition: Log.h:55
@ LOUD_UNSITUATED
Definition: Log.h:54
@ BAD
Definition: Log.h:49
@ OK
Definition: Log.h:48
@ TYPE_FILE
Definition: Log.h:40
@ TYPE_ASSERT
Definition: Log.h:41
@ TYPE_ERROR
Definition: Log.h:39
@ TYPE_PARAM
Definition: Log.h:42
@ TYPE_NEUTRAL
Definition: Log.h:37
@ TYPE_SUCCESS
Definition: Log.h:35
@ TYPE_TRIVIA
Definition: Log.h:43
@ TYPE_WARNING
Definition: Log.h:38
@ TYPE_INFO
Definition: Log.h:36

◆ once_map

std::unordered_map<size_t, size_t> Log::once_map

◆ output_targets

size_t Log::output_targets = LOG_OUT_STD | LOG_OUT_CUSTOM | LOG_OUT_FILE

◆ textout_func

void(* Log::textout_func) (Type, const char *) ( Type  ,
const char *   
) = nullptr