Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions serilog-settings-configuration.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
# Visual Studio Version 17
VisualStudioVersion = 17.8.34302.71
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4E41FD57-5FAB-4E3C-B16E-463DE98338BC}"
EndProject
Expand All @@ -13,11 +13,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{62D0B9
Build.ps1 = Build.ps1
CHANGES.md = CHANGES.md
Directory.Build.props = Directory.Build.props
global.json = global.json
assets\icon.png = assets\icon.png
LICENSE = LICENSE
README.md = README.md
serilog-settings-configuration.sln.DotSettings = serilog-settings-configuration.sln.DotSettings
global.json = global.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{D551DCB0-7771-4D01-BEBD-F7B57D1CF0E3}"
Expand All @@ -32,7 +32,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample", "sample\Sample\Sam
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDummies", "test\TestDummies\TestDummies.csproj", "{B7CF5068-DD19-4868-A268-5280BDE90361}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "test\TestApp\TestApp.csproj", "{1B6E08F3-16C9-4912-BEEE-57DB78C92A12}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "test\TestApp\TestApp.csproj", "{1B6E08F3-16C9-4912-BEEE-57DB78C92A12}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonShema.Playground", "test\JsonShema.Playground\JsonShema.Playground.csproj", "{3137E063-8AB6-4380-B246-AFA8AE28E26E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -58,6 +60,10 @@ Global
{B7CF5068-DD19-4868-A268-5280BDE90361}.Release|Any CPU.Build.0 = Release|Any CPU
{1B6E08F3-16C9-4912-BEEE-57DB78C92A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B6E08F3-16C9-4912-BEEE-57DB78C92A12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3137E063-8AB6-4380-B246-AFA8AE28E26E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3137E063-8AB6-4380-B246-AFA8AE28E26E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3137E063-8AB6-4380-B246-AFA8AE28E26E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3137E063-8AB6-4380-B246-AFA8AE28E26E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -68,6 +74,7 @@ Global
{A00E5E32-54F9-401A-BBA1-2F6FCB6366CD} = {D24872B9-57F3-42A7-BC8D-F9DA222FCE1B}
{B7CF5068-DD19-4868-A268-5280BDE90361} = {D551DCB0-7771-4D01-BEBD-F7B57D1CF0E3}
{1B6E08F3-16C9-4912-BEEE-57DB78C92A12} = {D551DCB0-7771-4D01-BEBD-F7B57D1CF0E3}
{3137E063-8AB6-4380-B246-AFA8AE28E26E} = {D551DCB0-7771-4D01-BEBD-F7B57D1CF0E3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {485F8843-42D7-4267-B5FB-20FE9181DEE9}
Expand Down
46 changes: 46 additions & 0 deletions test/JsonShema.Playground/Invalid/appsettings.serilog.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "../appsettings.schema.json",

"Serilog": {

"Using": "Serilog.Sinks.Console",
"MinimumLevel": "a",
"WriteTo": [
{ "x": "Console" },
{
"Name": 2,
"Args": ""
}
],
"Enrich": [
[ "FromLogContext" ],
{ "WithMachineName": -1 },
{ "Bad": { "WithThreadId": null } }
],
"Destructure": [
{
"Name": "With",
"Ar": { "policy": "Sample.CustomPolicy, Sample" }
},
{
"Name": "!ToMaximumDepth",
"Ar qs": { "maximumDestructuringDepth": 4 }
},
{
"Name": "1ToMaximumStringLength",
"Args": { "maximumStringLength": 100 }
},
{
"Name": "#ToMaximumCollectionCount",
"Args": { "maximumCollectionCount": 10 }
}
],
"Properties": [
{
"Application": "Sample"
}
],

"NotValid": "Test"
}
}
31 changes: 31 additions & 0 deletions test/JsonShema.Playground/Invalid/appsettings.serilog.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "../appsettings.schema.json",

"Serilog": {
"Using": [ "" ],
"LevelSwitches": { "1controlSwitch": "Bad" },
"FilterSwitches": { "_$filterSwitch": "" },

"MinimumLevel": {
"Default": 0,
"Override": {
"Microsoft": [""],
"MyApp.Something.Tricky": "None"
}
},
"WriteTo:Sublogger": {
"Name1": "Logger",
"2Args": { }
},
"WriteTo:$": {
"Name": "Async"
},
"WriteTo:ConditionalSink": {
"Conditional" : null
},

"Filter": {},
"Extra": []
}

}
9 changes: 9 additions & 0 deletions test/JsonShema.Playground/JsonShema.Playground.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
38 changes: 38 additions & 0 deletions test/JsonShema.Playground/Valid/appsettings.serilog.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "../appsettings.schema.json",

"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
"MinimumLevel": "Debug",
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": { "path": "Logs/log.txt" }
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Destructure": [
{
"Name": "With",
"Args": { "policy": "Sample.CustomPolicy, Sample" }
},
{
"Name": "ToMaximumDepth",
"Args": { "maximumDestructuringDepth": 4 }
},
{
"Name": "ToMaximumStringLength",
"Args": { "maximumStringLength": 100 }
},
{
"Name": "ToMaximumCollectionCount",
"Args": { "maximumCollectionCount": 10 }
}
],
"Properties": {
"Application": "Sample"
}
}

}
127 changes: 127 additions & 0 deletions test/JsonShema.Playground/Valid/appsettings.serilog.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"$schema": "../appsettings.schema.json",

"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"LevelSwitches": { "controlSwitch": "Verbose" },
"FilterSwitches": { "$filterSwitch": "Application = 'Sample'" },

"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"MyApp.Something.Tricky": "Verbose"
}
},
"WriteTo:Sublogger": {
"Name": "Logger",
"Args": {
"configureLogger": {
"MinimumLevel": "Verbose",
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {SourceContext} [{Level}] {Message}{NewLine}{Exception}",
"theme": "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Grayscale, Serilog.Sinks.Console"
}
}
]
},
"restrictedToMinimumLevel": "Verbose",
"levelSwitch": "$controlSwitch"
}
},
"WriteTo:Async": {
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "%TEMP%/Logs/serilog-configuration-sample.txt",
"outputTemplate": "{Timestamp:o} [{Level:u3}] ({Application}/{MachineName}/{ThreadId}/{ThreadName}) {Message}{NewLine}{Exception}"
}
}
]
}
},
"WriteTo:ConditionalSink": {
"Name": "Conditional",
"Args": {
"expression": "@Level in ['Error', 'Fatal']",
"configureSink": [
{
"Name": "File",
"Args": {
"path": "%TEMP%/Logs/serilog-configuration-sample-errors.txt",
"formatter": {
"type": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact",
"valueFormatter": {
"typeTagName": "customTypeTag"
}
}
}
}
]
}
},
"Enrich": [
"FromLogContext",
"WithThreadId",
{
"Name": "AtLevel",
"Args": {
"enrichFromLevel": "Error",
"configureEnricher": [ "WithThreadName" ]
}
},
{
"Name": "When",
"Args": {
"expression": "Application = 'Sample'",
"configureEnricher": [ "WithMachineName" ]
}
}
],
"Properties": {
"Application": "Sample"
},
"Destructure": [
{
"Name": "With",
"Args": { "policy": "Sample.CustomPolicy, Sample" }
},
{
"Name": "ToMaximumDepth",
"Args": { "maximumDestructuringDepth": 3 }
},
{
"Name": "ToMaximumStringLength",
"Args": { "maximumStringLength": 10 }
},
{
"Name": "ToMaximumCollectionCount",
"Args": { "maximumCollectionCount": 5 }
}
],
"Filter": [
{
"Name": "ControlledBy",
"Args": {
"switch": "$filterSwitch"
}
},
{
"Name": "With",
"Args": {
"filter": {
"type": "Sample.CustomFilter, Sample",
"levelFilter": "Verbose"
}
}
}
]
}

}
29 changes: 29 additions & 0 deletions test/JsonShema.Playground/Valid/appsettings.serilog.3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "../appsettings.schema.json",

"Serilog": {

"Using": [ "Serilog" ],

"LevelSwitches": { "controlSwitch": "Warning" },
"FilterSwitches": { "$filterSwitch": "Application = 'Sample'" },

"MinimumLevel": {
"Default": "controlSwitch",
"Override": {
"Microsoft": "Warning",
"MyApp.Something.Tricky": "Verbose"
}
},

"Enrich": [
"FromLogContext",
"WithThreadId"
],

"Properties": { "s": "as" },

"WriteTo": [ "Console" ]

}
}
Loading