forked from serilog/serilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved AppSettings support to Serilog.Settings.AppSettings
- Loading branch information
1 parent
505f6c8
commit e87b999
Showing
29 changed files
with
299 additions
and
283 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/Serilog.Settings.AppSettings/AppSettingsLoggerConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2013-2016 Serilog Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System; | ||
using Serilog.Configuration; | ||
using Serilog.Settings.AppSettings; | ||
|
||
namespace Serilog | ||
{ | ||
/// <summary> | ||
/// Extends <see cref="LoggerConfiguration"/> with support for System.Configuration appSettings elements. | ||
/// </summary> | ||
public static class AppSettingsLoggerConfigurationExtensions | ||
{ | ||
/// <summary> | ||
/// Reads the <appSettings> element of App.config or Web.config, searching for for keys | ||
/// that look like: <code>serilog:*</code>, which are used to configure | ||
/// the logger. To add a sink, use a key like <code>serilog:write-to:File.path</code> for | ||
/// each parameter to the sink's configuration method. To add an additional assembly | ||
/// containing sinks, use <code>serilog:using</code>. To set the level use | ||
/// <code>serilog:minimum-level</code>. | ||
/// </summary> | ||
/// <param name="settingConfiguration">Logger setting configuration.</param> | ||
/// <param name="settingPrefix">Prefix to use when reading keys in appSettings. If specified the value | ||
/// will be prepended to the setting keys and followed by :, for example "myapp" will use "myapp:serilog:minumum-level. If null | ||
/// no prefix is applied.</param> | ||
/// <returns>An object allowing configuration to continue.</returns> | ||
public static LoggerConfiguration AppSettings( | ||
this LoggerSettingsConfiguration settingConfiguration, string settingPrefix = null) | ||
{ | ||
if (settingConfiguration == null) throw new ArgumentNullException(nameof(settingConfiguration)); | ||
if (settingPrefix != null) | ||
{ | ||
if (settingPrefix.Contains(":")) throw new ArgumentException("Custom setting prefixes cannot contain the colon (:) character."); | ||
if (settingPrefix == "serilog") throw new ArgumentException("The value \"serilog\" is not a permitted setting prefix. To use the default, do not specify a custom prefix at all."); | ||
if (string.IsNullOrWhiteSpace(settingPrefix)) throw new ArgumentException("To use the default setting prefix, do not supply the settingPrefix parameter, instead pass the default null."); | ||
} | ||
|
||
return settingConfiguration.Settings(new AppSettingsSettings(settingPrefix)); | ||
} | ||
} | ||
} |
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
src/Serilog.Settings.AppSettings/Serilog.Settings.AppSettings.xproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
</PropertyGroup> | ||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" /> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>0d9f37e3-2cb4-4c0d-a307-32bb71defdd4</ProjectGuid> | ||
<RootNamespace>Serilog</RootNamespace> | ||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> | ||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild> | ||
</PropertyGroup> | ||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"version": "2.0.0-beta-*", | ||
"description": "XML configuration (System.Configuration <appSettings>) support for Serilog.", | ||
"authors": [ "Serilog Contributors" ], | ||
"tags": [ "serilog", "xml" ], | ||
"projectUrl": "http://serilog.net", | ||
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0", | ||
"iconUrl": "http://serilog.net/images/serilog-configuration-nuget.png", | ||
"dependencies": { | ||
"Serilog": { "target": "project" } | ||
}, | ||
"compilationOptions": { | ||
"keyFile": "../../assets/Serilog.snk" | ||
}, | ||
"frameworks": { | ||
"net45": { | ||
"frameworkAssemblies": { | ||
"System.Configuration": "" | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Serilog.Sinks.PeriodicBatching/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: AssemblyVersion("2.0.0.0")] | ||
|
||
[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=" + | ||
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" + | ||
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" + | ||
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" + | ||
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" + | ||
"b19485ec")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: AssemblyVersion("2.0.0.0")] | ||
|
||
[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=" + | ||
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" + | ||
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" + | ||
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" + | ||
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" + | ||
"b19485ec")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: AssemblyVersion("2.0.0.0")] | ||
|
||
[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=" + | ||
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" + | ||
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" + | ||
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" + | ||
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" + | ||
"b19485ec")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: AssemblyVersion("2.0.0.0")] | ||
|
||
[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=" + | ||
"0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" + | ||
"6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" + | ||
"d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" + | ||
"94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" + | ||
"b19485ec")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.