Skip to content

caiocezart/ExileCore2CustomLogger

Repository files navigation

Logger

A simple ImGui-based logger class library designed specifically for ExileCore2 plugins. This is not a standalone logging solution and requires ExileCore2 and ImGui.NET to function.

Features

  • ImGui-based visual logging window
  • Multiple log levels (Debug, Info, Warning, Error)
  • Color-coded log entries
  • Thread-safe logging using ConcurrentQueue
  • Auto-scrolling to latest log entries
  • Maximum entry limit to prevent memory issues
  • Pause/Resume logging functionality
  • Log level filtering via dropdown
  • JSON object logging support
  • Buffer size monitoring
  • Clear log functionality
  • Seamless integration with ExileCore2's ImGui implementation

Requirements

  • .NET 8.0
  • ImGui.NET (1.91.6.1 or higher)
  • Newtonsoft.Json (13.0.3 or higher)
  • ExileCore2 environment

Installation

  1. Add the project as a reference to your ExileCore2 plugin
  2. Or install via NuGet: dotnet add package ExileCore2CustomLogger

Basic Usage

// import the logger namespace
using Logger = ExileCore2CustomLogger.Logger;
// Initialize the logger with custom log level and max entries
var logLevel = LogLevel.Debug; 
// or from ExileCore2 Settings
var logLevel = (LogLevel)Settings.LogLevel.Value;

var logger = new Logger(logLevel, maxEntries: 2000);

// Log messages
logger.Debug("Debug message");
logger.Info("Info message");
logger.Warning("Warning message");
logger.Error("Error message");

// Log object as formatted JSON
var myObject = new { Name = "Test", Value = 123 };
logger.LogJson(myObject);


// Render the logger window (typically in your plugin's Render method)
public override void Render()
{
    if (Settings.Debug.ShowWindow)
    {
        logger.Render();
    }
}

Configuration

The logger can be initialized with custom log level and maximum entries:

// Default: LogLevel.Info, 1000 entries
var logger = new Logger();
var logLevel = LogLevel.Debug;

// Custom configuration
var logger = new Logger(LogLevel.Debug, maxEntries: 2000);

UI Controls

  • Clear: Clears all log entries
  • Pause/Resume: Freezes the log display for easier reading
  • Auto-scroll: Automatically scrolls to newest entries
  • Log Level: Dropdown to filter minimum log level
  • Buffer Size: Shows current/maximum entry count

License

MIT License

Credits

Created for use with ExileCore2 plugins.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages