33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using EonaCat.LogStack.Configuration;
|
|
using EonaCat.LogStack.Flows;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace EonaCat.LogStack.Flows.WindowsEventLog
|
|
{
|
|
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
|
// See the LICENSE file or go to https://EonaCat.com/License for full license details.
|
|
|
|
public static class EonaCatLogStackExtensions
|
|
{
|
|
/// <summary>
|
|
/// Write to Windows Event log
|
|
/// </summary>
|
|
public static LogBuilder WriteToWindowsEventLog(this LogBuilder logBuilder,
|
|
string sourceName = "EonaCatLogStack",
|
|
string logName = "Application",
|
|
int maxMessageLength = 30000,
|
|
Core.LogLevel minimumLevel = Core.LogLevel.Warning)
|
|
{
|
|
logBuilder.AddFlow(new WindowsEventLogFlow(
|
|
sourceName,
|
|
logName,
|
|
maxMessageLength,
|
|
minimumLevel));
|
|
WindowsEventLogFlow.EnsureSourceExists();
|
|
return logBuilder;
|
|
}
|
|
}
|
|
}
|