Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jjm-one/jjm.one.microsoft.extensions.logging.helpers
A collection of helper functions for the Microsoft logging tool.
https://github.com/jjm-one/jjm.one.microsoft.extensions.logging.helpers
csharp extension logging microsoft-extensions microsoft-extensions-logging
Last synced: 2 days ago
JSON representation
A collection of helper functions for the Microsoft logging tool.
- Host: GitHub
- URL: https://github.com/jjm-one/jjm.one.microsoft.extensions.logging.helpers
- Owner: jjm-one
- License: other
- Created: 2023-02-01T16:59:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-02T12:36:16.000Z (3 months ago)
- Last Synced: 2024-10-14T12:08:37.276Z (about 1 month ago)
- Topics: csharp, extension, logging, microsoft-extensions, microsoft-extensions-logging
- Language: C#
- Homepage: https://jjm-one.github.io/jjm.one.Microsoft.Extensions.Logging.Helpers/
- Size: 398 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# jjm.one.Microsoft.Extensions.Logging.Helpers
A collection of helper functions for the [Microsoft.Extensions.Logging](https://www.nuget.org/packages/Microsoft.Extensions.Logging) logging tool.
## Status
| | |
|----------------------:|-----------------------|
| Build & Test Status (main) | [![Build&Test](https://github.com/jjm-one/jjm.one.Microsoft.Extensions.Logging.Helpers/actions/workflows/dotnet.yml/badge.svg)](https://github.com/jjm-one/jjm.one.Microsoft.Extensions.Logging.Helpers/actions/workflows/dotnet.yml) |
| Nuget Package Version | [![Nuget Version](https://img.shields.io/nuget/v/jjm.one.Microsoft.Extensions.Logging.Helpers?style=flat-square)](https://www.nuget.org/packages/jjm.one.Microsoft.Extensions.Logging.Helpers/) |
| SonarCloudQuality Gate Status | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jjm-one_jjm.one.Microsoft.Extensions.Logging.Helpers&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jjm-one_jjm.one.Microsoft.Extensions.Logging.Helpers) |## Table of contents
- [jjm.one.Microsoft.Extensions.Logging.Helpers](#jjmonemicrosoftextensionslogginghelpers)
- [Status](#status)
- [Table of contents](#table-of-contents)
- [Nuget Package](#nuget-package)
- [Installing the Nuget Package](#installing-the-nuget-package)
- [Usage](#usage)
- [Use function logging](#use-function-logging)
- [Output of function logging](#output-of-function-logging)
- [Full Documentation](#full-documentation)
- [Repo](#repo)## Nuget Package
You can get the latest version of this software as a nuget package form [nuget.org](https://www.nuget.org/packages/jjm.one.Microsoft.Extensions.Logging.Helpers/)
### Installing the Nuget Package
| Tool | Command/Code |
|----------------------|--------------|
| Package Manager | ```PM> Install-Package jjm.one.Microsoft.Extensions.Logging.Helpers -Version X.Y.Z``` |
| .NET CLI | ```> dotnet add package jjm.one.Microsoft.Extensions.Logging.Helpers --version X.Y.Z``` |
| PackageReference | `````` |
| Package CLI | ```> paket add jjm.one.Microsoft.Extensions.Logging.Helpers --version X.Y.Z``` |
| Script & Interactive | ```> #r "nuget: jjm.one.Microsoft.Extensions.Logging.Helpers, X.Y.Z"``` |
| Cake as Addin | ```#addin nuget:?package=jjm.one.Microsoft.Extensions.Logging.Helpers&version=X.Y.Z``` |
| Cake as Tool | ```#tool nuget:?package=jjm.one.Microsoft.Extensions.Logging.Helpers&version=X.Y.Z``` |## Usage
### Use function logging
```csharp
class MyClass {// ...
void MyFancyFunction() {
// log the function call (minimal parameters)
logger.LogFctCall();// log the function call (full parameters)
logger.LogFctCall(GetType(), MethodBase.GetCurrentMethod(), LogLevel.Debug);try {
//...
}
catch (Exception exc) {// Log the exception (minimal parameters)
logger.LogExcInFctCall(exc);// Log the exception (full parameters)
logger.LogExcInFctCall(exc, GetType(), MethodBase.GetCurrentMethod(), "My custom exception message!", LogLevel.Error);
}
}// ...
}
```### Output of function logging
```text
Function called: MyClass -> MyFancyFunction
Exception thrown in: MyClass -> MyFancyFunction
My custom exception message!
```## Full Documentation
The full documentation for this package can be found [here](https://jjm-one.github.io/jjm.one.Microsoft.Extensions.Logging.Helpers/main/doc/html/index.html).
## Repo
The associated repo for this package can be found [here](https://github.com/jjm-one/jjm.one.Microsoft.Extensions.Logging.Helpers).