Packof7.Australia.FileLogger 1.0.0

A FileLogger to log files to a specific directory, given by a Configuration Setting

Suggested Alternatives

Packof7.Australia

Additional Details

The Packof7.Australia Package now consists of multiple Libraries including the FileLogger

There is a newer version of this package available.
See the version list below for details.
Install-Package Packof7.Australia.FileLogger -Version 1.0.0
dotnet add package Packof7.Australia.FileLogger --version 1.0.0
<PackageReference Include="Packof7.Australia.FileLogger" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Packof7.Australia.FileLogger --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Packof7.Australia.FileLogger, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Packof7.Australia.FileLogger as a Cake Addin
#addin nuget:?package=Packof7.Australia.FileLogger&version=1.0.0

// Install Packof7.Australia.FileLogger as a Cake Tool
#tool nuget:?package=Packof7.Australia.FileLogger&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FileLogger Documentation

The FileLogger is a simple logging tool to log directly to a File/Directory given by given Configuration settings.

Initialise Configuration Settings

To initialise the configuration settings for the LogFileConfiguration class, you can simply start by adding the configuration settings to your appsettings.json file, or by instantiating a new instance manually

appsettings.json

In the Startup.cs file, and then inside of the ConfigureServices() Method, add the following:

services.Configure<LogFileConfiguration>(Configuration.GetSection("FileLogger"));

Whenever you wish to use the Configuration Settings inside of another class, the following can simply done:

public ClassA(IOptions<LogFileConfiguration> configuraion)
{
        _configuration = configuration.Value;
}

public void SomeMethodInsideClassA()
{
        FileLogger fileLogger = new FileLogger(_configuration);
}

Manual Instantiation

To Simply Create a new instance of the configuration settings, you can also do the following:
public void SomeMethodInsideClassA()
{
        LogFileConfiguration configuration = new LogFileConfiguration();
        configuration.FilePath = "C:\\temp\\";
        configuration.FileName = "{DATE_UNIQUE}_file.log";
        configuration.Expiry = 0;
        configuration.MinLogLevel = "Information";
        FileLogger fileLogger = new FileLogger(configuration)
}

FileLogger Documentation

The FileLogger is a simple logging tool to log directly to a File/Directory given by given Configuration settings.

Initialise Configuration Settings

To initialise the configuration settings for the LogFileConfiguration class, you can simply start by adding the configuration settings to your appsettings.json file, or by instantiating a new instance manually

appsettings.json

In the Startup.cs file, and then inside of the ConfigureServices() Method, add the following:

services.Configure<LogFileConfiguration>(Configuration.GetSection("FileLogger"));

Whenever you wish to use the Configuration Settings inside of another class, the following can simply done:

public ClassA(IOptions<LogFileConfiguration> configuraion)
{
        _configuration = configuration.Value;
}

public void SomeMethodInsideClassA()
{
        FileLogger fileLogger = new FileLogger(_configuration);
}

Manual Instantiation

To Simply Create a new instance of the configuration settings, you can also do the following:
public void SomeMethodInsideClassA()
{
        LogFileConfiguration configuration = new LogFileConfiguration();
        configuration.FilePath = "C:\\temp\\";
        configuration.FileName = "{DATE_UNIQUE}_file.log";
        configuration.Expiry = 0;
        configuration.MinLogLevel = "Information";
        FileLogger fileLogger = new FileLogger(configuration)
}

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.2 223 7/28/2020
1.0.1 319 7/28/2020
1.0.0 333 7/28/2020