Skip to content

steven-hack/DotNetEssentials.Logging

Repository files navigation

.NET Essentials - Logging in .NET

This repository contains the demo project discussed in Betatalks episodes #95 and #96. In these talks, we explore various aspects of logging in .NET, including logger messages, log properties, tag providers, redactors, and enrichers.

This demo project is an integral part of the two-part episode about Logging in .NET, hosted on YouTube. Make sure to watch these episodes to better understand the source code:

For more topics about Software Development in .NET & Azure, check out the entire Betatalks playlist available on YouTube.

Overview

Logging is an essential aspect of any software application as it helps in understanding application behavior, debugging issues, and monitoring performance. In the .NET ecosystem, logging is facilitated by various frameworks such as Serilog, NLog, and Microsoft.Extensions.Logging.

This project serves as a demonstration of best practices and essential techniques for effective logging in .NET applications using Microsoft.Extensions.Logging.

Features

  • Logger Messages: Demonstrates how to create log messages using different severity levels (e.g., Information, Warning, Error) and structured logging.
  • Log Properties: Shows how to attach additional properties or metadata to log messages for better categorization and analysis.
  • Tag Providers: Illustrates the use of tag providers to dynamically enrich log messages with contextual information.
  • Redactors: Explores techniques for redacting sensitive information from log messages to maintain data privacy.
  • Enrichers: Demonstrates how enrichers can automatically add contextual information to log messages (e.g., timestamps, machine information).

Getting Started

To get started with this project, follow these steps:

  1. Clone this repository to your local machine:
git clone https://github.com/steven-hack/DotNetEssentials.Logging.git
  1. Navigate to the project directory:
cd DotNetEssentials.Logging
  1. Open the solution in your preferred IDE or text editor.

  2. Explore the minimal API endpoints defined in Program.cs.

Requirements

  • .NET SDK (version 8.0 or later)
  • [Optional] IDE or text editor (e.g., Visual Studio, Visual Studio Code)

Usage

Feel free to use the code provided in this repository as a reference or starting point for implementing logging in your .NET applications. Each feature or technique is well-documented within the codebase to facilitate understanding and adaptation.

Contributing

Contributions to this project are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Contact

For any questions or inquiries about this project, feel free to contact Steven Hack.

Enjoy logging in .NET! 🚀

About

C# demo project focused on the essentials of logging in .NET

Topics

Resources

License

Stars

Watchers

Forks

Languages