Skip to content

Commit fdf0f20

Browse files
author
Stan van Rooy
committed
misc: initial commit
0 parents  commit fdf0f20

File tree

7 files changed

+551
-0
lines changed

7 files changed

+551
-0
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "main" ]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v3
17+
with:
18+
dotnet-version: 7.0.x
19+
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
23+
- name: Build
24+
run: dotnet build --no-restore
25+
26+
- name: Test
27+
run: dotnet test --no-build --verbosity normal
28+
29+
- name: Connect to package registry
30+
run: cd Elfsquad.ParseableSerilogSink
31+
32+
- name: Pack
33+
run: cd Elfsquad.ParseableSerilogSink && dotnet pack Elfsquad.ParseableSerilogSink.csproj --verbosity normal -c Release
34+
35+
- name: Push
36+
run: cd Elfsquad.ParseableSerilogSink && dotnet nuget push "bin/Release/Elfsquad.ParseableSerilogSink.*.nupkg"
37+

.gitignore

Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
###################
5+
# compiled source #
6+
###################
7+
*.com
8+
*.class
9+
*.dll
10+
*.exe
11+
*.pdb
12+
*.dll.config
13+
*.cache
14+
*.suo
15+
# Include dlls if they’re in the NuGet packages directory
16+
!/packages/*/lib/*.dll
17+
# Include dlls if they're in the CommonReferences directory
18+
!*CommonReferences/*.dll
19+
####################
20+
# VS Upgrade stuff #
21+
####################
22+
_UpgradeReport_Files/
23+
###############
24+
# Directories #
25+
###############
26+
bin/
27+
obj/
28+
TestResults/
29+
###################
30+
# Web publish log #
31+
###################
32+
*.Publish.xml
33+
#############
34+
# Resharper #
35+
#############
36+
/_ReSharper.*
37+
*.ReSharper.*
38+
############
39+
# Packages #
40+
############
41+
# it’s better to unpack these files and commit the raw source
42+
# git has its own built in compression methods
43+
*.7z
44+
*.dmg
45+
*.gz
46+
*.iso
47+
*.jar
48+
*.rar
49+
*.tar
50+
*.zip
51+
######################
52+
# Logs and databases #
53+
######################
54+
*.log
55+
*.sqlite
56+
# OS generated files #
57+
######################
58+
.DS_Store?
59+
ehthumbs.db
60+
Icon?
61+
Thumbs.db
62+
63+
64+
# User-specific files
65+
*.user
66+
*.userosscache
67+
*.sln.docstates
68+
69+
# User-specific files (MonoDevelop/Xamarin Studio)
70+
*.userprefs
71+
72+
# Build results
73+
[Dd]ebug/
74+
[Dd]ebugPublic/
75+
[Rr]elease/
76+
[Rr]eleases/
77+
x64/
78+
x86/
79+
build/
80+
bld/
81+
[Bb]in/
82+
[Oo]bj/
83+
84+
# Visual Studo 2015 cache/options directory
85+
.vs/
86+
87+
# MSTest test Results
88+
[Tt]est[Rr]esult*/
89+
[Bb]uild[Ll]og.*
90+
91+
# NUNIT
92+
*.VisualState.xml
93+
TestResult.xml
94+
95+
# Build Results of an ATL Project
96+
[Dd]ebugPS/
97+
[Rr]eleasePS/
98+
dlldata.c
99+
100+
# DNX
101+
project.lock.json
102+
artifacts/
103+
104+
*_i.c
105+
*_p.c
106+
*_i.h
107+
*.ilk
108+
*.meta
109+
*.obj
110+
*.pch
111+
*.pgc
112+
*.pgd
113+
*.rsp
114+
*.sbr
115+
*.tlb
116+
*.tli
117+
*.tlh
118+
*.tmp
119+
*.tmp_proj
120+
*.vspscc
121+
*.vssscc
122+
.builds
123+
*.pidb
124+
*.svclog
125+
*.scc
126+
127+
# Chutzpah Test files
128+
_Chutzpah*
129+
130+
# Visual C++ cache files
131+
ipch/
132+
*.aps
133+
*.ncb
134+
*.opensdf
135+
*.sdf
136+
*.cachefile
137+
138+
# Visual Studio profiler
139+
*.psess
140+
*.vsp
141+
*.vspx
142+
143+
# TFS 2012 Local Workspace
144+
$tf/
145+
146+
# Guidance Automation Toolkit
147+
*.gpState
148+
149+
# ReSharper is a .NET coding add-in
150+
_ReSharper*/
151+
*.[Rr]e[Ss]harper
152+
*.DotSettings.user
153+
154+
# JustCode is a .NET coding add-in
155+
.JustCode
156+
157+
# TeamCity is a build add-in
158+
_TeamCity*
159+
160+
# DotCover is a Code Coverage Tool
161+
*.dotCover
162+
163+
# NCrunch
164+
_NCrunch_*
165+
.*crunch*.local.xml
166+
167+
# MightyMoose
168+
*.mm.*
169+
AutoTest.Net/
170+
171+
# Web workbench (sass)
172+
.sass-cache/
173+
174+
# Installshield output folder
175+
[Ee]xpress/
176+
177+
# DocProject is a documentation generator add-in
178+
DocProject/buildhelp/
179+
DocProject/Help/*.HxT
180+
DocProject/Help/*.HxC
181+
DocProject/Help/*.hhc
182+
DocProject/Help/*.hhk
183+
DocProject/Help/*.hhp
184+
DocProject/Help/Html2
185+
DocProject/Help/html
186+
187+
# Click-Once directory
188+
publish/
189+
190+
# Publish Web Output
191+
*.[Pp]ublish.xml
192+
*.azurePubxml
193+
# TODO: Comment the next line if you want to checkin your web deploy settings
194+
# but database connection strings (with potential passwords) will be unencrypted
195+
*.pubxml
196+
*.publishproj
197+
198+
# NuGet Packages
199+
*.nupkg
200+
# The packages folder can be ignored because of Package Restore
201+
**/packages/*
202+
# except build/, which is used as an MSBuild target.
203+
!**/packages/build/
204+
# Uncomment if necessary however generally it will be regenerated when needed
205+
#!**/packages/repositories.config
206+
207+
# Windows Azure Build Output
208+
csx/
209+
*.build.csdef
210+
211+
# Windows Store app package directory
212+
AppPackages/
213+
214+
# Visual Studio cache files
215+
# files ending in .cache can be ignored
216+
*.[Cc]ache
217+
# but keep track of directories ending in .cache
218+
!*.[Cc]ache/
219+
220+
# Others
221+
ClientBin/
222+
[Ss]tyle[Cc]op.*
223+
~$*
224+
*~
225+
*.dbmdl
226+
*.dbproj.schemaview
227+
*.pfx
228+
*.publishsettings
229+
node_modules/
230+
bower_components/
231+
orleans.codegen.cs
232+
233+
# RIA/Silverlight projects
234+
Generated_Code/
235+
236+
# Backup & report files from converting an old project file
237+
# to a newer Visual Studio version. Backup files are not needed,
238+
# because we have git ;-)
239+
_UpgradeReport_Files/
240+
Backup*/
241+
UpgradeLog*.XML
242+
UpgradeLog*.htm
243+
244+
# SQL Server files
245+
*.mdf
246+
*.ldf
247+
248+
# Business Intelligence projects
249+
*.rdl.data
250+
*.bim.layout
251+
*.bim_*.settings
252+
253+
# Microsoft Fakes
254+
FakesAssemblies/
255+
256+
# Node.js Tools for Visual Studio
257+
.ntvs_analysis.dat
258+
259+
# Visual Studio 6 build log
260+
*.plg
261+
262+
# Visual Studio 6 workspace options file
263+
*.opt
264+
265+
.idea/

Elfsquad.ParseableSerilogSink.csproj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<PropertyGroup>
10+
<Version>0.0.1</Version>
11+
<Authors>stanvanrooy</Authors>
12+
<Company>Elfsquad</Company>
13+
<PackageProjectUrl>https://github.com/Elfsquad/Elfsquad.ParseableSerilogSink</PackageProjectUrl>
14+
<PackageLicenseExpression>LICENSE.txt</PackageLicenseExpression>
15+
<LangVersion>11.0</LangVersion>
16+
<EnablePackageValidation>true</EnablePackageValidation>
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
21+
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
22+
<PackageReference Include="Serilog" Version="2.12.0" />
23+
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="3.1.0" />
24+
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1">
25+
<PrivateAssets>all</PrivateAssets>
26+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
27+
</PackageReference>
28+
</ItemGroup>
29+
30+
31+
</Project>

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Elfsquad
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/LoggerConfigurationExtensions.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Serilog;
2+
using Serilog.Configuration;
3+
using Serilog.Sinks.PeriodicBatching;
4+
5+
namespace Elfsquad.ParseableSerilogSink;
6+
7+
public static class LoggerConfigurationExtensions
8+
{
9+
public static LoggerConfiguration Parseable(
10+
this LoggerSinkConfiguration loggerConfiguration,
11+
ParseableSinkOptions options
12+
)
13+
{
14+
if (loggerConfiguration == null)
15+
throw new ArgumentNullException(nameof(loggerConfiguration));
16+
17+
var parseableSink = new ParseableSink(options);
18+
19+
var batchingOptions = new PeriodicBatchingSinkOptions
20+
{
21+
BatchSizeLimit = options.BatchSizeLimit,
22+
Period = TimeSpan.FromSeconds(1),
23+
EagerlyEmitFirstEvent = true
24+
};
25+
26+
var batchingSink = new PeriodicBatchingSink(parseableSink, batchingOptions);
27+
28+
return loggerConfiguration.Sink(batchingSink);
29+
}
30+
}

0 commit comments

Comments
 (0)