Logging
RED4ext provides a logger for every plugin through the SDK class. First time a message is logged RED4ext will create a log file with the plugin's name in <game_directory>/red4ext/logs directory.
The logger settings, such as rotation, file size, etc., are based on the user's configuration file.

Example

1
#include <RED4ext/RED4ext.hpp>
2
​
3
RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::PluginHandle aHandle, RED4ext::EMainReason aReason, const RED4ext::Sdk* aSdk)
4
{
5
switch (aReason)
6
{
7
case RED4ext::EMainReason::Load:
8
{
9
aSdk->logger->Trace(aHandle, "Hello World!");
10
aSdk->logger->TraceF(aHandle, "Hello %s!", "World");
11
​
12
break;
13
}
14
case RED4ext::EMainReason::Unload:
15
{
16
break;
17
}
18
}
19
​
20
return true;
21
}
Copied!
Export as PDF
Copy link
Contents
Example