A logging utility class for handling console and file-based logging.
More...
#include <CLog.h>
|
static void | Init (const std::string &logName, const std::string &logFilePath="") |
| Initializes the logging system.
|
|
static void | Shutdown () |
| Shuts down the logging system and closes the log file.
|
|
template<typename... Args> |
static void | Log (LogLevel level, const std::string &message, const char *file, int line, Args... args) |
| Logs a message to the console and/or a JSON file.
|
|
A logging utility class for handling console and file-based logging.
This class provides static methods for logging messages to the console and to a JSON file. It supports different log levels and can be initialized and shut down as needed.
◆ LogLevel
Represents the severity level of a log message.
Enumerator |
---|
INFO | Informational messages.
|
WARNING | Warning messages.
|
CERROR | Error messages.
|
LOG | General log messages.
|
◆ Init()
static void CLog::Init |
( |
const std::string & | logName, |
|
|
const std::string & | logFilePath = "" ) |
|
inlinestatic |
Initializes the logging system.
- Parameters
-
logName | The name of the log file. |
logFilePath | The directory path where the log file will be created. Defaults to an empty string. |
This method creates the log directory if it does not exist and opens a new log file with a timestamp in its name. The log file is opened in truncation mode.
◆ Log()
template<typename... Args>
static void CLog::Log |
( |
LogLevel | level, |
|
|
const std::string & | message, |
|
|
const char * | file, |
|
|
int | line, |
|
|
Args... | args ) |
|
inlinestatic |
Logs a message to the console and/or a JSON file.
- Template Parameters
-
Args | Variadic template for additional arguments to format the message. |
- Parameters
-
level | The severity level of the log message. |
message | The log message format string. |
file | The source file where the log was generated. |
line | The line number in the source file where the log was generated. |
args | Additional arguments for formatting the message. |
This method prints the formatted message to the console (if in EDITOR mode) and writes it to the JSON log file (if in _DEBUG mode).
◆ Shutdown()
static void CLog::Shutdown |
( |
| ) |
|
|
inlinestatic |
Shuts down the logging system and closes the log file.
This method writes the closing bracket to the JSON log file and closes the file stream.
The documentation for this class was generated from the following file:
- D:/DEV JEUX/2025/CPP/Opengl/ClutterEngineOpenGL/ClutterEngine/Engine/Core/Debug/CLog/CLog.h