This commit is contained in:
2026-08-04 11:41:26 +02:00
committed by Jeroen Saey
parent 4d75deea6f
commit 82fac06d8f
4 changed files with 9 additions and 61 deletions
+6
View File
@@ -12,6 +12,12 @@ var logger = new LogBuilder("MyApp")
.BoostWithProcessId() .BoostWithProcessId()
.Build(); .Build();
while (true)
{
logger.Information("Application started - iteration ");
logger.Error(new Exception("Nerd!"), "Something went wrong - iteration");
}
Console.WriteLine("Logger created successfully"); Console.WriteLine("Logger created successfully");
Console.WriteLine("Writing log entries..."); Console.WriteLine("Writing log entries...");
+3 -3
View File
@@ -14,7 +14,7 @@ It features a rich fluent API for routing log events to dozens of destinations f
<Copyright>EonaCat (Jeroen Saey)</Copyright> <Copyright>EonaCat (Jeroen Saey)</Copyright>
<PackageTags>EonaCat;Logger;EonaCatLogStack;Log;Writer;Flows;LogStack;Memory;Speed;Jeroen;Saey</PackageTags> <PackageTags>EonaCat;Logger;EonaCatLogStack;Log;Writer;Flows;LogStack;Memory;Speed;Jeroen;Saey</PackageTags>
<PackageIconUrl /> <PackageIconUrl />
<FileVersion>0.1.8</FileVersion> <FileVersion>0.1.9</FileVersion>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
@@ -25,7 +25,7 @@ It features a rich fluent API for routing log events to dozens of destinations f
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<EVRevisionFormat>0.1.8+{chash:10}.{c:ymd}</EVRevisionFormat> <EVRevisionFormat>0.1.9+{chash:10}.{c:ymd}</EVRevisionFormat>
<EVDefault>true</EVDefault> <EVDefault>true</EVDefault>
<EVInfo>true</EVInfo> <EVInfo>true</EVInfo>
<EVTagMatch>v[0-9]*</EVTagMatch> <EVTagMatch>v[0-9]*</EVTagMatch>
@@ -36,7 +36,7 @@ It features a rich fluent API for routing log events to dozens of destinations f
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Version>0.1.8</Version> <Version>0.1.9</Version>
<PackageId>EonaCat.LogStack</PackageId> <PackageId>EonaCat.LogStack</PackageId>
<Product>EonaCat.LogStack</Product> <Product>EonaCat.LogStack</Product>
<RepositoryUrl>https://git.saey.me/EonaCat/EonaCat.LogStack</RepositoryUrl> <RepositoryUrl>https://git.saey.me/EonaCat/EonaCat.LogStack</RepositoryUrl>
@@ -181,8 +181,6 @@ namespace EonaCat.LogStack.Flows
throw new ArgumentNullException("template"); throw new ArgumentNullException("template");
} }
CheckForProcessTermination();
_directory = directory; _directory = directory;
_password = password; _password = password;
_filePrefix = filePrefix; _filePrefix = filePrefix;
@@ -263,33 +261,6 @@ namespace EonaCat.LogStack.Flows
_retentionThread.Start(); _retentionThread.Start();
} }
private void CheckForProcessTermination()
{
AppDomain.CurrentDomain.ProcessExit += (_, __) =>
{
try
{
DisposeAsync().AsTask().GetAwaiter().GetResult();
}
catch
{
// Do nothing
}
};
Console.CancelKeyPress += (_, e) =>
{
try
{
DisposeAsync().AsTask().GetAwaiter().GetResult();
}
catch
{
// Do nothing
}
};
}
/// <summary>Add an ambient property enricher applied to every event.</summary> /// <summary>Add an ambient property enricher applied to every event.</summary>
public EncryptedFileFlow EnrichWith(string key, Func<LogEvent, object> valueFactory) public EncryptedFileFlow EnrichWith(string key, Func<LogEvent, object> valueFactory)
{ {
@@ -185,8 +185,6 @@ namespace EonaCat.LogStack.Flows
throw new ArgumentNullException("template"); throw new ArgumentNullException("template");
} }
CheckForProcessTermination();
_batchSize = batchSize <= 0 ? 1 : batchSize; _batchSize = batchSize <= 0 ? 1 : batchSize;
_directory = directory; _directory = directory;
_filePrefix = filePrefix; _filePrefix = filePrefix;
@@ -247,33 +245,6 @@ namespace EonaCat.LogStack.Flows
_retentionTask = Task.Factory.StartNew(RetentionLoop, TaskCreationOptions.LongRunning); _retentionTask = Task.Factory.StartNew(RetentionLoop, TaskCreationOptions.LongRunning);
} }
private void CheckForProcessTermination()
{
AppDomain.CurrentDomain.ProcessExit += (_, __) =>
{
try
{
DisposeAsync().AsTask().GetAwaiter().GetResult();
}
catch
{
// Do nothing
}
};
Console.CancelKeyPress += (_, e) =>
{
try
{
DisposeAsync().AsTask().GetAwaiter().GetResult();
}
catch
{
// Do nothing
}
};
}
/// <summary>Add an ambient property enricher applied to every event.</summary> /// <summary>Add an ambient property enricher applied to every event.</summary>
public FileFlow EnrichWith(string key, Func<LogEvent, object> valueFactory) public FileFlow EnrichWith(string key, Func<LogEvent, object> valueFactory)
{ {