using EonaCat.LogStack.Core;
using System.Runtime.CompilerServices;
using System.Threading;

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.

    public sealed class ThreadNameBooster : BoosterBase
    {
        public ThreadNameBooster() : base("ThreadName") { }

        [System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override bool Boost(ref LogEventBuilder builder)
        {
            builder.WithProperty("ThreadName", Thread.CurrentThread.Name ?? "n/a");
            return true;
        }
    }
}
