Psimsa.TinyLogger 1.0.23

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

// Install Psimsa.TinyLogger as a Cake Tool
#tool nuget:?package=Psimsa.TinyLogger&version=1.0.23

tiny-logger

A small, performant library for basic console logging in .Net projects. Implements the ILogger interface from Microsoft.Extensions.Logging, but with a smaller footprint and list of dependencies.

The library provides basic feature set for logging to the console while being usable in components and dependencies that use ILogger for output, well usable for instance in AOT-published tools.

Features

  • Does not use Microsoft.Extensions.DependencyInjection at all (unlike LoggerFactory.Create which uses it under the hood)
  • Fully supports AOT / code trimming
  • Outputs structured logs in JSON format
  • Minimal footprint in terms of memory usage, allocations etc.
  • Supports log levels, log templates and code-generated log methods
  • Can be used in any .Net project, including .Net Standard libraries (from 2.0)
  • Can be used in code-generated DI containers (e.g. Pure.DI)
  • Performs well in container or cloud scenarios where console output is captured by the runtime and further analyzed in e.g. CloudWatch or Application Insights
  • Performance comparable with Microsoft.Extensions.Logging (see benchmarks project in test folder / snapshot below)

Usage

ILogger logger = new TinyLogger<Program>();
logger.LogInformation("Hello world!");

Benchmarks


BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1555/22H2/2022Update/SunValley2)
11th Gen Intel Core i7-11850H 2.50GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.203
  [Host]     : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
  Job-MFQIFX : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2

Runtime=.NET 7.0  IterationCount=1  

Method Mean Error Allocated
Log_SingleThread_TinyLogger 119.5 μs NA 1.28 KB
Log_SingleThread_ConsoleLogger 114.2 μs NA 1.22 KB
Log_MultiThread_TinyLogger 112,887.2 μs NA 370.11 KB
Log_MultiThread_ConsoleLogger 116,492.2 μs NA 666.77 KB
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.0.23 87 4/12/2024
1.0.22 90 3/13/2024
1.0.21 86 2/21/2024
1.0.20 83 2/16/2024
1.0.19 83 2/16/2024
1.0.18 93 2/6/2024
1.0.17 105 1/17/2024
1.0.16 95 1/15/2024
1.0.15 100 1/5/2024
1.0.14 90 1/5/2024
1.0.13 100 12/23/2023
1.0.12 88 12/14/2023
1.0.11 92 12/9/2023
1.0.10 97 12/6/2023
1.0.9 127 11/18/2023
1.0.8 90 11/14/2023
1.0.7 91 11/8/2023
1.0.6 105 11/2/2023
1.0.5 111 11/1/2023
1.0.4 95 11/1/2023
1.0.3 111 10/16/2023
1.0.2 117 10/13/2023
1.0.1 118 10/5/2023
1.0.0 100 10/5/2023
0.1.22 136 9/8/2023
0.1.21 123 9/5/2023
0.1.20 123 9/4/2023
0.1.19 124 8/31/2023
0.1.18 110 8/29/2023
0.1.17 113 8/21/2023
0.1.16 122 8/16/2023
0.1.15 138 8/4/2023
0.1.14 148 8/4/2023
0.1.13 152 7/15/2023
0.1.12 161 7/11/2023
0.1.11 163 7/7/2023
0.1.10 147 6/27/2023
0.1.9 158 6/13/2023
0.1.8 147 6/6/2023
0.1.7 153 6/2/2023
0.1.6 144 5/16/2023
0.1.5 177 4/18/2023
0.1.4 167 4/17/2023
0.1.3 189 4/17/2023