🖍️
RED4ext Plugin Dev
HomeRED ModdingDiscordGitHub
  • Home
  • Getting Started
    • Installing RED4ext
    • Installing a Plugin
    • Configuration
    • Uninstalling
  • Mod Developers
    • RED4ext & RED4ext.SDK
      • Browse Red4Ext: NativeDB
    • Creating a Plugin
    • Creating a Custom Native Class
    • Adding a Native Function
    • Custom game states
    • Logging
    • Creating a plugin with RedLib
    • Installing a plugin with red-cli
  • Utils
    • NativeDB
    • CRC32 Hasher
    • FNV1A64 Hasher
Powered by GitBook
On this page
Edit on GitHub
Export as PDF
  1. Mod Developers

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

#include <RED4ext/RED4ext.hpp>

RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::PluginHandle aHandle, RED4ext::EMainReason aReason, const RED4ext::Sdk* aSdk)
{
    switch (aReason)
    {
    case RED4ext::EMainReason::Load:
    {
        aSdk->logger->Trace(aHandle, "Hello World!");
        aSdk->logger->TraceF(aHandle, "Hello %s!", "World");

        break;
    }
    case RED4ext::EMainReason::Unload:
    {
        break;
    }
    }

    return true;
}
PreviousCustom game statesNextCreating a plugin with RedLib

Last updated 1 year ago