FLog.NET 1.1.0

dotnet add package FLog.NET --version 1.1.0
NuGet\Install-Package FLog.NET -Version 1.1.0
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="FLog.NET" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FLog.NET --version 1.1.0
#r "nuget: FLog.NET, 1.1.0"
#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 FLog.NET as a Cake Addin
#addin nuget:?package=FLog.NET&version=1.1.0

// Install FLog.NET as a Cake Tool
#tool nuget:?package=FLog.NET&version=1.1.0

FLog

Simple logging utility for logging at different levels with various handlers, formatters and destinations.

Usage

public static void Main()
{
    // Adding handler - to show log messages (ILoggerHandler)
    Logger.LoggerHandlerManager
        .AddHandler(new ConsoleLoggerHandler())
        .AddHandler(new FileLoggerHandler())
        .AddHandler(new DebugConsoleLoggerHandler());

    // Fast logging (monitor name of class and methods from which is the application logged)
    Logger.Log();

    // We define a log message
    Logger.Log("Hello world");

    // We can define the level (type) of message
    Logger.Log(Logger.Level.Fine, "Explicitly define level");

    // Explicit definition of the class from which the logging
    Logger.Log<Program>("Explicitly define log class");
    Logger.Log<Program>(Logger.Level.Fine, "Explicitly define log class and level");

    // Settings of default type of message
    Logger.DefaultLevel = Logger.Level.Severe;

    // Stack trace is preserved through exceptions.
    try 
    {
        throw new Exception();
    }
    catch (Exception exception)
    {
        Logger.Log(exception);
        Logger.Log<Program>(exception);
    }

    // Logging through Debug outlet - toggleable via DebugOff and DebugOn
    Logger.Debug.Log("Debug log");
    Logger.Debug.Log<Program>("Debug log");

    Logger.DebugEnabled = false;
    Logger.Debug.Log("Not-logged message");

    Logger.DebugEnabled = true;
    Logger.Debug.Log("I'am back!");

    Console.ReadKey();
}
Output
12.10.2012 21:43: Info [line: 18 Program -> Main()]: There is no message
12.10.2012 21:43: Info [line: 21 Program -> Main()]: Hello world
12.10.2012 21:43: Fine [line: 24 Program -> Main()]: Explicit define level
12.10.2012 21:43: Info [line: 27 Program -> Main()]: Explicit define log class
12.10.2012 21:43: Fine [line: 28 Program -> Main()]: Explicit define log class and level
12.10.2012 21:43: Error [line: 35 Program -> Main()]: Exception of type 'System.Exception' was thrown.
12.10.2012 21:43: Error [line: 35 Program -> Main()]: Log exception -> Message: Exception of type 'System.Exception' was thrown.
StackTrace:    at FLog.Sample.Program.Main() in Program.cs:line 35

12.10.2012 21:43: Debug [line: 47 Program -> Main()]: Debug log
12.10.2012 21:43: Debug [line: 48 Program -> Main()]: Debug log
12.10.2012 21:43: Debug [line: 55 Program -> Main()]: I'am back!

Modules

Email module

// Email module sample
public static void EmaiLModuleSample()
{
    // Configuring smtp server
    var smtpServerConfiguration = new SmtpServerConfiguration("userName", "password", "smtp.gmail.com", 587);

    // Creating a module
    var emailSenderLoggerModule = new EmailSenderLoggerModule(smtpServerConfiguration)
    {
        EnableSsl = true,
        Sender = "sender-email@gmail.com"
    };

    // Adding recipients
    emailSenderLoggerModule.Recipients.Add("recipients@gmail.com");

    // Add the module and it works
    Logger.Modules.Install(emailSenderLoggerModule);

    try
    {
        // Simulation of exceptions
        throw new NullReferenceException();
    }
    catch (Exception exception)
    {
        // Log exception
        // If you catch an exception error -> will be sent an email with a list of log message.
        Logger.Log(exception);
    }
}

MS SQL database module

// MS SQL database module sample
public static void MsSqlDatabaseLoggerModuleSample()
{
    var connectionString = "Your connection string";

    // Just add the module and it works! 
    Logger.Modules.Install(new MsSqlDatabaseLoggerModule(connectionString));
    Logger.Log("My first database log! ");
}
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  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.

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.1.0 1,481 6/15/2018
1.0.0 1,447 2/7/2018