tiny.Logger 5.0.4.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package tiny.Logger --version 5.0.4.2
                    
NuGet\Install-Package tiny.Logger -Version 5.0.4.2
                    
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="tiny.Logger" Version="5.0.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="tiny.Logger" Version="5.0.4.2" />
                    
Directory.Packages.props
<PackageReference Include="tiny.Logger" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add tiny.Logger --version 5.0.4.2
                    
#r "nuget: tiny.Logger, 5.0.4.2"
                    
#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.
#:package tiny.Logger@5.0.4.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=tiny.Logger&version=5.0.4.2
                    
Install as a Cake Addin
#tool nuget:?package=tiny.Logger&version=5.0.4.2
                    
Install as a Cake Tool

tiny.Logger

Most powerful, multithreaded file logger for high touch application written for .net

Build Status

Features

  • Thread safe file logger.
  • Log shipping based on size.
  • File Name support for custom formats
  • Safe execution handles.
  • .net framework is also supported.

Installation

Install-Package tiny.Logger

.net core / .net 5 Sample

Example 1

code example

public static IHostBuilder CreateHostBuilder(string[] args) =>
            Tiny.CreateDefaultBuilderAndTinyLogger(args).....

Example 2

code example

public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureTinyLogger().....
Customization from appsettings.json
"Logging": {
    "LogLevel": {
      "Default": "Trace",
      "Microsoft": "Trace",
      "Microsoft.Hosting.Lifetime": "Trace"
    },
    "options": {
      "file": "MYLOG_$|DATE[dd_MMM_yyyy HH_mm]|$.log",  //<--- (1)
      "path":  "c:\\temp", //<--- (2)
      "size": 5242880 //<--- (3)
    }
  },
  1. "file" ⇒ Name of file.
    • available options
      • $|DATE|$ = for date without format
      • $|DATE[FORMAT]|$ = customize format as per your need e.g. MYLOG_$|DATE[dd_MMM_yyyy HH_mm]|$.logMYLOG_DATE01_JAN_2021 10_45.log
  2. path: folder path for log file
    • available options
      • using environment variables support %temp%\logsC:\Users...\AppData\Local\Temp
  3. size
    • minimum is 1048576 (1MB) in case of smaller value than 1MB will be ignored.
    • if option is missing means disable log shipping based on size. .

.Net Framework Setup.

namespace Sample
{
    using tiny;
    using Microsoft.Extensions.Logging;

    class Program
    {
        static void Main(string[] args)
        {
            // first line of execution or before using logger....
            Extensions.ConfigureTinyLogger(@"c:\temp", MinLogLevel: LogLevel.Trace, ...);
            
            // Code to execute.
            
            var data = new Data() { Property1 = "Some value" };
            Extensions.LogInformation("First Log as information", data);
            
            // Code to execute.
            

Safe Executions

Example in .net core / .net 5

Use this option to wrap exuection with exception handling


       public int Sample1Sum(int i, int j)
       {
           int k = 0;
           _logger.ExecuteWithLog(() => { k = i + j; });
           return k;
       }

       public int Sample2Sum(int i, int j)
       {
           return _logger.ExecuteWithLog<int>(() => i + j);
       }

       public int Sample3Sum(int i, int j)
       {
           return _logger.ExecuteWithLog<int>(() => i/0 + j, defaultResult: 0);
       }

Example in .net framework
            Extensions.ILogger.ExecuteWithLog(() => 
            { 
                // code 
            });
ps: You can use Exception, for after execution deligates to perform operations based on your needs

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on tiny.Logger:

Package Downloads
tiny.WebApi

A Powerful WebApi written to ease up webapi development purely based on the configuration - supports MSSQL Server, PostgreSQL and Oracle databases.

tiny.ImageHelper

A library for modifying key attributes for EMF file. Supports Modifying Font Color Background Color Convert to Black and white Convert to gray scale

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.4 237 5/14/2025
9.0.3 223 5/13/2025
9.0.2 140 12/17/2024
9.0.1 104 12/17/2024 9.0.1 is deprecated because it has critical bugs.
9.0.0 119 11/21/2024
8.0.0 427 11/28/2023
6.0.6 190 10/6/2023
6.0.5 244 8/31/2023
6.0.4 1,255 11/24/2022 6.0.4 is deprecated because it is no longer maintained.
6.0.3 645 9/16/2022
6.0.2 1,063 8/4/2022
6.0.1 1,205 2/20/2022
6.0.0 605 12/25/2021 6.0.0 is deprecated because it has critical bugs.
5.0.6 597 3/16/2021
5.0.5 546 3/12/2021 5.0.5 is deprecated.
5.0.4.4 595 3/12/2021 5.0.4.4 is deprecated because it is no longer maintained.
5.0.4.3 576 2/26/2021 5.0.4.3 is deprecated because it is no longer maintained.
5.0.4.3-alpha 303 2/26/2021 5.0.4.3-alpha is deprecated because it has critical bugs.
5.0.4.2 586 2/24/2021 5.0.4.2 is deprecated because it has critical bugs.
5.0.4.1 555 2/23/2021 5.0.4.1 is deprecated because it is no longer maintained.
5.0.4.1-alpha 435 2/23/2021 5.0.4.1-alpha is deprecated.
5.0.4 501 2/23/2021 5.0.4 is deprecated.
5.0.3 542 2/23/2021 5.0.3 is deprecated.
5.0.2 524 2/23/2021 5.0.2 is deprecated.
5.0.1 528 2/22/2021 5.0.1 is deprecated.
5.0.0 526 2/22/2021 5.0.0 is deprecated because it has critical bugs.
1.0.3 542 2/21/2021 1.0.3 is deprecated because it has critical bugs.
1.0.2 521 2/21/2021 1.0.2 is deprecated because it is no longer maintained.
1.0.0 505 2/20/2021 1.0.0 is deprecated because it has critical bugs.
0.0.1-alpha 421 2/20/2021 0.0.1-alpha is deprecated because it has critical bugs.