mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-07 00:16:36 -08:00
23 lines
630 B
C#
23 lines
630 B
C#
using CounterStrikeSharp.API.Core.Plugin;
|
|
using Serilog.Core;
|
|
using Serilog.Events;
|
|
|
|
namespace CounterStrikeSharp.API.Core.Logging;
|
|
|
|
public class PluginNameEnricher : ILogEventEnricher
|
|
{
|
|
public const string PropertyName = "PluginName";
|
|
|
|
public PluginNameEnricher(PluginContext pluginContext)
|
|
{
|
|
Context = pluginContext;
|
|
}
|
|
|
|
public PluginContext Context { get; }
|
|
|
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
|
{
|
|
var property = propertyFactory.CreateProperty(PropertyName, Context.Plugin.ModuleName);
|
|
logEvent.AddPropertyIfAbsent(property);
|
|
}
|
|
} |