using EonaCat.LogStack.Core;
using System.Diagnostics;
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 process ID to log events
/// </summary>
public sealed class ProcessIdBooster : BoosterBase
{
    private static readonly int ProcessId = Process.GetCurrentProcess().Id;

    public ProcessIdBooster() : base("ProcessId") { }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override bool Boost(ref LogEventBuilder builder)
    {
        builder.WithProperty("ProcessId", ProcessId);
        return true;
    }
}
