Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/samhammerag/samhammer.logging

Logging abstraction for .NET Core
https://github.com/samhammerag/samhammer.logging

dotnet net-core-project-lib

Last synced: 23 days ago
JSON representation

Logging abstraction for .NET Core

Awesome Lists containing this project

README

        

# Samhammer.Logging

Logging abstraction for .NET Core

## Usage
### Custom logger:
```csharp
public abstract class BaseLogger : Samhammer.Logging.BaseLogger, ILog
```

```csharp
public class NLogLogger : BaseLogger
{
...
public override void Log(string message, string logType, Samhammer.Logging.LogDetails details, Samhammer.Logging.LogLevel loglevel, Exception ex, string memberName, string sourceFilePath,
int sourceLineNumber)
{
...
}
}
```

Create a class that inherits from this packages BaseLogger and implements the log method. This method needs to either call some other logging framework, or directly output the log.

### Setup & Use Logger
```csharp
Logger.Init(() => new SerilogLogger(), fallbackLogType);
```

```csharp
ILog log = Logger.Log();

log.Error("Example", LogType.SomeType);
```

## Packages
| Package |
| --- |
| [Samhammer.Logging](https://www.nuget.org/packages/Samhammer.Logging/) |
| [Samhammer.Logging.Serilog](https://www.nuget.org/packages/Samhammer.Logging.Serilog/) |

## Contribute
#### How to publish package
- How to publish package
- set package version in Samhammer.Logging.csproj
- add information to changelog
- create git tag ( v )
- the package will automatically be published via github actions