Files
EonaCat.LogStack/EonaCat.LogStack/EonaCatLoggerCore/Boosters/EnvironmentBooster.cs
2026-02-28 07:19:29 +01:00

28 lines
822 B
C#

using EonaCat.LogStack.Core;
using System.Runtime.CompilerServices;
namespace EonaCat.LogStack.Boosters;
// 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.
/// <summary>
/// Adds environment name to log events
/// </summary>
public sealed class EnvironmentBooster : BoosterBase
{
private readonly string _environmentName;
public EnvironmentBooster(string environmentName) : base("Environment")
{
_environmentName = environmentName ?? "Production";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Boost(ref LogEventBuilder builder)
{
builder.WithProperty("Environment", _environmentName);
return true;
}
}