Table of Contents

Delegate SapLogAction

Namespace
SapGui.Wrapper
Assembly
SapGui.Wrapper.dll

A lightweight logging delegate for integrating SapGui.Wrapper log output into any logging framework, without requiring a dependency on Microsoft.Extensions.Logging in the consuming project.

Pass an instance to Attach(SapLogAction?, SapLogLevel, ILogger?) or LaunchWithSso(string, bool, int, SapLogAction?, SapLogLevel, ILogger?).

Examples:

// Console output
SapGuiClient.Attach(logAction: (level, msg, ex) =>
    Console.WriteLine($"[{level}] {msg}{(ex is null ? "" : " – " + ex.Message)}"));

// Serilog static Log class (no ILogger needed) SapGuiClient.Attach(logAction: (level, msg, ex) => Serilog.Log.Write(ToSerilogLevel(level), ex, "{Message}", msg));

// UiPath Invoke Code activity (Log() is the built-in UiPath logging action) SapGuiClient.Attach(logAction: (level, msg, _) => Log($"[SAP] {msg}"));

public delegate void SapLogAction(SapLogLevel level, string message, Exception? exception)

Parameters

level SapLogLevel

Severity level of the message.

message string

Human-readable log message.

exception Exception

Associated exception, or null.