Delegate SapLogAction
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
levelSapLogLevelSeverity level of the message.
messagestringHuman-readable log message.
exceptionExceptionAssociated exception, or null.