NeoSimpleLogger 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NeoSimpleLogger --version 1.0.0
                    
NuGet\Install-Package NeoSimpleLogger -Version 1.0.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="NeoSimpleLogger" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NeoSimpleLogger" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NeoSimpleLogger" />
                    
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 NeoSimpleLogger --version 1.0.0
                    
#r "nuget: NeoSimpleLogger, 1.0.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 NeoSimpleLogger@1.0.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=NeoSimpleLogger&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NeoSimpleLogger&version=1.0.0
                    
Install as a Cake Tool

πŸ“¦ NuGet Package Documentation: Logger


πŸ” Overview

NeoSimpleLogger is a lightweight, cross-platform logging utility for .NET applications that provides color-coded console output with timestamped logs for different severity levels: Error, Warn, Info, and Debug.

Key features:

  • Colorful console logging for easy visual distinction.
  • Timestamp included in every log entry.
  • Conditional stack trace display in DEBUG mode for errors and warnings.
  • Minimal dependencies (only standard .NET libraries).

πŸ“¦ Installation

Install the package via NuGet:

dotnet add package NeoSimpleLogger

Or via the NuGet Package Manager in Visual Studio.


πŸ“Œ Usage

1. Log Messages

Use the static methods provided in the Logger class to log messages:

Logger.Error("This is an error message.");
Logger.Warn("This is a warning message.");
Logger.Info("This is an informational message.");
Logger.Debug("This is a debug message.");
2. Example Output

When running the above code, the console output would look like this:

[14:30:45.123] ERROR  This is an error message.
[14:30:45.124] WARN   This is a warning message.
[14:30:45.125] INFO   This is an informational message.
[14:30:45.126] DEBUG  This is a debug message.
  • Colors:
    • ERROR β†’ Red
    • WARN β†’ Yellow
    • INFO β†’ Green
    • DEBUG β†’ Magenta
    • Timestamp β†’ Dark Gray

πŸ› οΈ Conditional Debug Mode

In DEBUG mode, the logger will also display the stack trace for ERROR and WARN messages:

[14:30:45.123] ERROR  This is an error message.
Call stack: ...

This is enabled via the #if DEBUG preprocessor directive.


πŸ“œ License

This package is distributed under the GNU General Public License v3 (GPLv3).

License URL:
https://www.gnu.org/licenses/gpl-3.0.html

Important Notes:

  • GPLv3 is a copyleft license, which requires that any derivative work must be distributed under the same license.
  • If you distribute an application that uses this package, you must provide the source code of your project and this package (or a derivative of it).
  • Use this license only if you are comfortable with the copyleft terms.

πŸ“¦ Compatibility

  • Target Frameworks: .NET 8.0+
  • Platforms: Windows, Linux, macOS (cross-platform)

πŸ“š Example Project

For a full example, see the GitHub repository


πŸ“‘ Contact

If you have questions, suggestions, or want to report an issue, please contact the maintainer at:


πŸ“¦ Package Version

  • Current Version: 1.0.0
  • NuGet Package ID: NeoSimpleLogger

πŸ“ Notes

  • This package is not thread-safe. If used in multi-threaded applications, ensure proper synchronization.
  • The logger uses Console.WriteLine, so it is best suited for console-based applications. For GUI or file-based logging, consider using a more advanced logging framework (e.g., Serilog, NLog).

πŸ“¦ Summary

| Feature | Description | | License | GPLv3 | | Platforms | Windows, Linux, macOS | | Log Levels | Error, Warn, Info, Debug | | Color Support | Yes | | Timestamp | Yes | | Stack Trace | Yes (in DEBUG mode) |


βœ… Conclusion

Logger is a simple, effective, and visually appealing logging utility for .NET developers. It’s ideal for quick prototyping, debugging, or small to medium-sized applications that need basic logging with color and timestamps.


πŸ“„ License File

The full GPLv3 license is included in the NuGet package as LICENSE.txt. You can also view it at:

https://www.gnu.org/licenses/gpl-3.0.html

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.
  • net9.0

    • 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.