Files
EonaCat.LogStack/EonaCat.LogStack/EonaCatLoggerCore/Boosters/UptimeBooster.cs
T
2026-04-06 08:15:54 +02:00

26 lines
873 B
C#

using EonaCat.LogStack.Core;
using System;
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.
public sealed class UptimeBooster : BoosterBase
{
private static readonly DateTime ProcessStart = Process.GetCurrentProcess().StartTime;
public UptimeBooster() : base("Uptime") { }
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Boost(ref LogEventBuilder builder)
{
var uptime = (DateTime.Now - ProcessStart).TotalSeconds;
builder.WithProperty("Uptime", uptime);
return true;
}
}
}