LiveForensics.LogFileHelper 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LiveForensics.LogFileHelper --version 1.0.1                
NuGet\Install-Package LiveForensics.LogFileHelper -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LiveForensics.LogFileHelper" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LiveForensics.LogFileHelper --version 1.0.1                
#r "nuget: LiveForensics.LogFileHelper, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LiveForensics.LogFileHelper as a Cake Addin
#addin nuget:?package=LiveForensics.LogFileHelper&version=1.0.1

// Install LiveForensics.LogFileHelper as a Cake Tool
#tool nuget:?package=LiveForensics.LogFileHelper&version=1.0.1                
using LiveForensics.LogFileHelper;
using System;

namespace LogFileDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            // create a simple log file
            LogFileHelper log1 = new LogFileHelper(@"c:\temp\mylog.log");
            // and write something to it
            log1.WriteToLogFile("Something happened");
            Console.WriteLine("Press a key to continue");
            Console.ReadKey();
            // clean out the log file
            log1.Clear();
            // change the maximum size, the default is 1M byte
            log1.SetMaximumLogSize(2000000);

            // set up a log file with some categories
            LogFileHelper log2 = new LogFileHelper(@"c:\temp\mylog2.log");
            log2.AddCategory("Error", true);
            log2.AddCategory("Warning", true);
            log2.AddCategory("Info", true);

            // write to a category
            // if the category is active, the message is written to the log file
            log2.WriteToLogFile("Something bad happened!", "Error");
            log2.WriteToLogFile("New file was created", "Info");

            // we don't want to see info messages
            log2.HideCategory("Info");
            // just to prove it won't get written
            log2.WriteToLogFile("this won't appear in the log", "Info");
            // turn info back on
            log2.ShowCategory("Info");
            log2.WriteToLogFile("and we're back", "Info");

            // create log files inside the system log folder
            // in my case C:\Windows\System32\LogFiles\mynewproduct\mylog3.log
            LogFileHelper log3 = new LogFileHelper("mylog3.log", "mynewproduct");
            log3.WriteToLogFile("Something happened");

        }
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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 Downloads Last updated
1.0.2 1,124 12/21/2017
1.0.1 1,058 12/13/2017

The first release of this library.