| | 1 | | using Serilog; |
| | 2 | | using Serilog.Configuration; |
| | 3 | | using Serilog.Core; |
| | 4 | | using Serilog.Events; |
| | 5 | |
|
| | 6 | |
|
| | 7 | | namespace Kestrun.Logging.Sinks.Extensions; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// Provides extension methods for configuring PowerShell sinks in Serilog logging. |
| | 11 | | /// </summary> |
| | 12 | | public static class PowerShellSinkExtensions |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Adds a PowerShell sink to the Serilog logger configuration. |
| | 16 | | /// </summary> |
| | 17 | | /// <param name="loggerConfiguration">The logger sink configuration.</param> |
| | 18 | | /// <param name="callback">Callback to handle log events and formatted output.</param> |
| | 19 | | /// <param name="restrictedToMinimumLevel">The minimum level for events passed through the sink.</param> |
| | 20 | | /// <param name="outputTemplate">The output template for formatting log messages.</param> |
| | 21 | | /// <param name="levelSwitch">Optional level switch for controlling logging level.</param> |
| | 22 | | /// <returns>The logger configuration with the PowerShell sink added.</returns> |
| | 23 | | public static LoggerConfiguration PowerShell(this LoggerSinkConfiguration loggerConfiguration, |
| | 24 | | Action<LogEvent, string> callback, |
| | 25 | | LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, |
| | 26 | | string outputTemplate = PowerShellSink.DEFAULT_OUTPUT_TEMPLATE, |
| 5 | 27 | | LoggingLevelSwitch? levelSwitch = null) => loggerConfiguration.Sink(new PowerShellSink(callback, outputTemplate) |
| | 28 | | } |