ObjectLogger 1.1.0

dotnet add package ObjectLogger --version 1.1.0
                    
NuGet\Install-Package ObjectLogger -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="ObjectLogger" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ObjectLogger" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ObjectLogger" />
                    
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 ObjectLogger --version 1.1.0
                    
#r "nuget: ObjectLogger, 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.
#:package ObjectLogger@1.1.0
                    
#: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=ObjectLogger&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ObjectLogger&version=1.1.0
                    
Install as a Cake Tool

ObjectLogger

A custom logger for formatted logging

Installation

Install-Package ObjectLogger

Usage example

  1. Call builder.Services.AddLogMessageLogger() extension method to include the LogMessageLogger to the DI. This is the simplest logger with the included base class for logging.
    1. Call builder.Services.AddLogMessageLogger(builder.Configuration) to set your TupleConflictStrategy settings (see more later).
  2. Change ILogger with ILogMessageLogger in every place you use the logger
  3. Enjoy 😃

Tips

  1. You can inherit from LogMessage to use any custom class with this logger
  2. When using the Tuple feature, you might write the same key twice, to handle this I use TupleConflictStrategy:
    1. "MAKE_LIST" - Default. Will convert the value to be a list of all values with the same key.
    2. "KEEP_FIRST" - Will keep only the first key-value
    3. "KEEP_LAST" - Will keep only the last key-value
  3. If you want to use your own class, use IObjectLogger<T, O> where T is the class name and O is your custom log object
  4. For better logging parsing and usage, change the logger format to only include the message itself

Contributing

  1. Fork it (https://github.com/javitolin/ObjectLogger/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Meta

AsadoDevCulture

@jdorfsman

Distributed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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 125 2/19/2025
1.0.0 164 2/17/2025 1.0.0 is deprecated.