How to Configure Logging Levels in Wand Enhancer: A Complete Guide

You configure logging levels in Wand Enhancer by filtering the Action<string, ELogType> logger callback passed to the Enhancer class, using the ELogType enumeration defined in Logs.cs to specify verbosity thresholds.

Wand Enhancer implements a type‑safe logging system centered on a simple callback pattern and a severity enumeration. To configure which messages appear in the output, you must understand how the ELogType enum structures severity and how the core engine receives log output.

Understanding the Logging Architecture

The ELogType Enumeration in Logs.cs

According to the Wand Enhancer source code, the available logging levels are declared in WandEnhancer/View/MainWindow/Logs.cs as the ELogType enumeration. This enum defines four distinct severity levels:

  • Info – General informational messages
  • Success – Operations that completed successfully
  • Warning – Recoverable problems that deserve attention
  • Error – Fatal errors or unexpected failures

The enum order follows increasing severity: Info < Success < Warning < Error.

The Logger Callback Pattern

The Enhancer class in WandEnhancer/Core/Enhancer.cs does not write to the console directly. Instead, it receives an Action<string, ELogType> callback that forwards text and severity to the UI or any custom handler. For example, the core engine emits logs via calls such as:

_logger($"{prefix} Patch applied", ELogType.Success);
_logger("[ENHANCER] Injected remote panel assets …", ELogType.Info);
_logger($"[ENHANCER] Failed to copy logs: {e.Message}", ELogType.Error);

How to Configure Logging Levels Programmatically

By default, the Enhancer emits all log levels. To configure verbosity, wrap the original logger with a filter that checks the ELogType value against a minimum threshold before forwarding the message.

// Define the minimum level you want to keep
const ELogType minLevel = ELogType.Warning;

// Wrap the original logger to filter levels
Action<string, ELogType> filteredLogger = (msg, level) =>
{
    if (level >= minLevel)   // Only allow Warning and Error
        originalLogger(msg, level);
};

// Pass the filtered logger to the Enhancer constructor
var enhancer = new Enhancer(config, filteredLogger, patchConfig);

This approach lets you silence Info and Success messages while preserving critical output without modifying the core library files.

UI-Based Log Filtering

The LogList Collection in MainWindowVm.cs

The MainWindowVm class in WandEnhancer/View/MainWindow/MainWindowVm.cs maintains an observable collection named LogList. The Log method creates LogEntry objects containing the message, type, and timestamp:

public void Log(string message, ELogType logType)
{
    var entry = new LogEntry
    {
        Timestamp = DateTime.Now,
        Message   = $"[{logType}] {message}",
        Type      = logType
    };
    LogList.Add(entry);
}

Viewing Filtered Output

The UI binds to LogList and typically provides a ComboBox or similar control bound to the ELogType values. This allows users to filter the visible log entries at the presentation layer, independent of the core logging configuration.

Practical Implementation Examples

Example 1 – Emitting logs at each level:

_logger("Application started", ELogType.Info);
_logger("Patch file loaded", ELogType.Success);
_logger("Using deprecated API", ELogType.Warning);
_logger("Failed to read config", ELogType.Error);

Example 2 – Creating a filtered logger (warnings and errors only):

Action<string, ELogType> filtered = (msg, lvl) =>
{
    if (lvl is ELogType.Warning or ELogType.Error)
        Console.WriteLine($"[{lvl}] {msg}");
};

var enhancer = new Enhancer(weModConfig, filtered, patchConfig);

Example 3 – UI-bound log entry handling:

// Inside MainWindowVm.cs
public void Log(string message, ELogType logType)
{
    var entry = new LogEntry
    {
        Timestamp = DateTime.Now,
        Message   = $"[{logType}] {message}",
        Type      = logType
    };
    LogList.Add(entry);
}

Summary

  • The ELogType enum in WandEnhancer/View/MainWindow/Logs.cs defines four levels: Info, Success, Warning, and Error.
  • Configure logging levels by wrapping the Action<string, ELogType> callback passed to the Enhancer class with a filtering condition based on enum comparison.
  • The UI layer in WandEnhancer/View/MainWindow/MainWindowVm.cs aggregates logs in LogList and can filter the display independently of the core logger.
  • Enum values follow natural order where Info < Success < Warning < Error, enabling simple threshold checks.

Frequently Asked Questions

Where is the logging level enum defined in Wand Enhancer?

The ELogType enumeration is defined in WandEnhancer/View/MainWindow/Logs.cs. It contains four values—Info, Success, Warning, and Error—that represent increasing severity levels used throughout the application.

How do I suppress informational messages in Wand Enhancer?

Wrap the logger callback with a condition that checks if the level meets your minimum threshold. For example, check if (level >= ELogType.Warning) before calling the original logger to suppress Info and Success messages while retaining warnings and errors.

Can I change logging levels without modifying the source code?

Yes. You can inject a filtered logger at the composition root where you instantiate the Enhancer class. By passing a wrapper around the original logger that filters by ELogType, you control verbosity programmatically without altering the internal Enhancer or MainWindowVm implementations.

Does Wand Enhancer support dynamic log level changes at runtime?

While the core Enhancer receives a fixed callback at initialization, you can implement a mutable wrapper that checks a configurable threshold variable. The UI layer in MainWindowVm already supports dynamic filtering by binding LogList to view controls that filter by ELogType in real time.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →