Skip to content

Commit a05b073

Browse files
committed
README and NuGet package metadata
1 parent b1578f4 commit a05b073

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

GmodNET.Serilog.Sink/GmodNET.Serilog.Sink.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PropertyGroup>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1818
<Product>GmodNET Serilog Sink</Product>
19-
<Description>A Serilog Sink for Garry's Mod Clients' and Servers' consoles.</Description>
19+
<Description>A Serilog Sink for Garry's Mod clients' and servers' consoles for GmodDotNet modules.</Description>
2020
<RepositoryUrl>https://github.com/GmodNET/GmodSerilog</RepositoryUrl>
2121
<RepositoryType>Git</RepositoryType>
2222
<PackageTags>garrysmod; GmodNET; Serilog; serilog-sink</PackageTags>

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
11
# GmodSerilog
2-
A Serilog Sink for Garry's Mod Clients' and Servers' consoles.
2+
A [Serilog](https://serilog.net/) Sink for Garry's Mod clients' and servers' consoles for [GmodDotNet](https://github.com/GmodNET/GmodDotNet) modules.
3+
4+
## Usage
5+
GmodNET.Serilog.Sink can be used with Serilog logger as [any other standard sink](https://github.com/serilog/serilog/wiki/Configuration-Basics) by calling corresponding extension method on `LoggerSinkConfiguration`. Here is an example of usage of GmodNET.Serilog.Sink with [GmodDotNet](https://github.com/GmodNET/GmodDotNet) module:
6+
7+
```csharp
8+
using GmodNET.API;
9+
using Serilog;
10+
using Serilog.Core;
11+
using Serilog.Events;
12+
using GmodNET.Serilog.Sink;
13+
14+
namespace Tests
15+
{
16+
public class ExampleModule : IModule
17+
{
18+
public string ModuleName => "ExampleModule";
19+
20+
public string ModuleVersion => "1.0.0";
21+
public void Load(ILua lua, bool is_serverside, ModuleAssemblyLoadContext assembly_context)
22+
{
23+
Logger logger = new LoggerConfiguration() // Create a logger configuration
24+
.MinimumLevel.Information() // Set a global minimal event level for logger to Information
25+
.WriteTo.GmodSink(restrictedToMinimumLevel: LogEventLevel.Warning) // Add a game console sink which writes only events of Warning severity level and above
26+
.CreateLogger();
27+
28+
logger.Warning("Here is a warning to game console!");
29+
}
30+
31+
public void Unload(ILua lua)
32+
{
33+
34+
}
35+
}
36+
}
37+
```

0 commit comments

Comments
 (0)