Log - SWTube/Darkest-Cave GitHub Wiki
Log
- defined in header
"Debug/Log.h"
The class Log
provides support for logging messages in the engine. Log
is used to print log messages to console output
Global objects
Type | Definition |
---|---|
Log |
LogManager |
MAX_BUFFER |
255 |
eLogVerbosity |
All Verbose Debug Info Warn Error Assert |
eLogChannel |
GRAPHICS = 0x00 PHYSICS = 0x20 AUDIO = 0x40 AI = 0x60 GAMEPLAY = 0x80 CORE = 0xa0 CORE_MODULE = 0xa1 CORE_UNIT_TEST = 0xa2 CORE_MEMORY = 0xa3 CORE_MATH = 0xa4 CORE_STRING = 0xa5 CORE_LOCALIZATION = 0xa6 CORE_PARSER = 0xa7 CORE_PROFILE = 0xa8 CORE_ENGINE_CONFIG = 0xa9 CORE_RNG = 0xaa CORE_OBJECT = 0xab CORE_THREAD = 0xac CORE_CONTAINER = 0xad CORE_FILE_SYSTEM = 0xae CORE_TIMER = 0xaf CORE_RESOURCE_MANAGER = 0xb0 |
Member functions
SetVerbosity
static void SetVerbosity(eLogVerbosity verbosity);
Sets the current verbosity level.
Parameters
verbosity
- verbosity level to set
Example
#include "Core.h"
int main()
{
Log::SetVerbosity(eLogVerbosity::DEBUG);
return 0;
}
Verbose
/ LOGV
static void Verbose(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message
);
#define LOGV(channel, os, message) cave::LogManager::Verbose(channel, __FILE__, __func__, __LINE__, os, message)
- WIN32
- Prints verbose log message to Win32 debug console.
- UNIX
- Prints verbose log message in white color to corresponding channel's
stdout
.
- Prints verbose log message in white color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGV(eLogChannel::CORE, std::cout, "Hello, World!");
return 0;
}
Output:
Core/V/../../../Samples/Main.cpp/main/line:5 : Hello, World!
VerboseF
/ LOGVF
static void VerboseF(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message,
...
);
#define LOGVF(channel, os, message, ...) cave::LogManager::Verbose(channel, __FILE__, __func__, __LINE__, os, message, ...)
- WIN32
- Prints formatted verbose log message to Win32 debug console.
- UNIX
- Prints formatted verbose log message in white color to corresponding channel's
stdout
.
- Prints formatted verbose log message in white color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGVF(eLogChannel::CORE, std::cout, "1 + 1 = %d", 2);
return 0;
}
Output:
Core/V/../../../Samples/Main.cpp/main/line:5 : 1 + 1 = 2
Debug
/ LOGD
static void Debug(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message
);
#define LOGD(channel, os, message) cave::LogManager::Debug(channel, __FILE__, __func__, __LINE__, os, message)
- WIN32
- Prints debug log message to Win32 debug console.
- UNIX
- Prints debug log message in green color to corresponding channel's
stdout
.
- Prints debug log message in green color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGD(eLogChannel::CORE, std::cout, "Hello, World!");
return 0;
}
Output:
Core/D/../../../Samples/Main.cpp/main/line:5 : Hello, World!
DebugF
/ LOGDF
static void DebugF(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message,
...
);
#define LOGDF(channel, os, message, ...) cave::LogManager::DebugF(channel, __FILE__, __func__, __LINE__, os, message, ...)
- WIN32
- Prints formatted debug log message to Win32 debug console.
- UNIX
- Prints formatted debug log message in green color to corresponding channel's
stdout
.
- Prints formatted debug log message in green color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGDF(eLogChannel::CORE, std::cout, "1 + 1 = %d", 2);
return 0;
}
Output:
Core/D/../../../Samples/Main.cpp/main/line:5 : 1 + 1 = 2
Info
/ LOGI
static void Info(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message
);
#define LOGI(channel, os, message) cave::LogManager::Info(channel, __FILE__, __func__, __LINE__, os, message)
- WIN32
- Prints informational log message to Win32 debug console.
- UNIX
- Prints informational log message in yellow color to corresponding channel's
stdout
.
- Prints informational log message in yellow color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGI(eLogChannel::CORE, std::cout, "Hello, World!");
return 0;
}
Output:
Core/I/../../../Samples/Main.cpp/main/line:5 : Hello, World!
InfoF
/ LOGIF
static void InfoF(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message,
...
);
#define LOGIF(channel, os, message, ...) cave::LogManager::InfoF(channel, __FILE__, __func__, __LINE__, os, message, ...)
- WIN32
- Prints formatted informational log message to Win32 debug console.
- UNIX
- Prints formatted informational log message in yellow color to corresponding channel's
stdout
.
- Prints formatted informational log message in yellow color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGIF(eLogChannel::CORE, std::cout, "1 + 1 = %d", 2);
return 0;
}
Output:
Core/I/../../../Samples/Main.cpp/main/line:5 : 1 + 1 = 2
Warn
/ LOGW
static void Warn(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message
);
#define LOGW(channel, os, message) cave::LogManager::Warn(channel, __FILE__,__func__, __LINE__, os, message)
- WIN32
- Prints warning log message to Win32 debug console.
- UNIX
- Prints warning log message in magenta color to corresponding channel's
stdout
.
- Prints warning log message in magenta color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGW(eLogChannel::CORE, std::cout, "Hello, World!");
return 0;
}
Output:
Core/W/../../../Samples/Main.cpp/main/line:5 : Hello, World!
WarnF
/ LOGWF
static void WarnF(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message,
...
);
#define LOGWF(channel, os, message, ...) cave::LogManager::WarnF(channel, __FILE__, __func__, __LINE__, os, message, ...)
- WIN32
- Prints formatted warning log message to Win32 debug console.
- UNIX
- Prints formatted warning log message in magenta color to corresponding channel's
stdout
.
- Prints formatted warning log message in magenta color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGWF(eLogChannel::CORE, std::cout, "1 + 1 = %d", 2);
return 0;
}
Output:
Core/W/../../../Samples/Main.cpp/main/line:5 : 1 + 1 = 2
Error
/ LOGE
static void Error(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message
);
#define LOGE(channel, os, message) cave::LogManager::Error(channel, __FILE__, __func__, __LINE__, os, message)
- WIN32
- Prints error log message to Win32 debug console.
- UNIX
- Prints error log message in red color to corresponding channel's
stdout
.
- Prints error log message in red color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGE(eLogChannel::CORE, std::cout, "Hello, World!");
return 0;
}
Output:
Core/E/../../../Samples/Main.cpp/main/line:5 : Hello, World!
ErrorF
/ LOGEF
static void ErrorF(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message,
...
);
#define LOGEF(channel, os, message, ...) cave::LogManager::ErrorF(channel, __FILE__, __func__, __LINE__, os, message, ...)
- WIN32
- Prints formatted error log message to Win32 debug console.
- UNIX
- Prints formatted error log message in red color to corresponding channel's
stdout
.
- Prints formatted error log message in red color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGEF(eLogChannel::CORE, std::cout, "1 + 1 = %d", 2);
return 0;
}
Output:
Core/E/../../../Samples/Main.cpp/main/line:5 : 1 + 1 = 2
Assert
/ LOGA
static void Assert(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message
);
#define LOGA(channel, os, message) cave::LogManager::Assert(channel, __FILE__, __func__, __LINE__, os, message)
- WIN32
- Prints assert log message to Win32 debug console.
- UNIX
- Prints assert log message in cyan color to corresponding channel's
stdout
.
- Prints assert log message in cyan color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGA(eLogChannel::CORE, std::cout, "Hello, World!");
return 0;
}
Output:
Core/A/../../../Samples/Main.cpp/main/line:5 : Hello, World!
AssertF
/ LOGAF
static void AssertF(
eLogChannel channel,
const char* fileName,
const char* functionName,
int32_t lineNumber,
std::ostream& os,
const char* message,
...
);
#define LOGAF(channel, os, message, ...) cave::LogManager::AssertF(channel, __FILE__, __func__, __LINE__, os, message, ...)
- WIN32
- Prints formatted assert log message to Win32 debug console.
- UNIX
- Prints formatted assert log message in cyan color to corresponding channel's
stdout
.
- Prints formatted assert log message in cyan color to corresponding channel's
Example
- Samples/Main.cpp
#include "Debug/Log.h"
int main()
{
LOGAF(eLogChannel::CORE, std::cout, "1 + 1 = %d", 2);
return 0;
}
Output:
Core/A/../../../Samples/Main.cpp/main/line:5 : 1 + 1 = 2