13
13
// limitations under the License.
14
14
15
15
using System ;
16
+ using System . ComponentModel ;
16
17
using Serilog . Configuration ;
17
18
using Serilog . Settings . AppSettings ;
18
19
@@ -23,6 +24,26 @@ namespace Serilog
23
24
/// </summary>
24
25
public static class AppSettingsLoggerConfigurationExtensions
25
26
{
27
+ /// <summary>
28
+ /// Reads the <appSettings> element of App.config or Web.config, searching for for keys
29
+ /// that look like: <code>serilog:*</code>, which are used to configure
30
+ /// the logger. To add a sink, use a key like <code>serilog:write-to:File.path</code> for
31
+ /// each parameter to the sink's configuration method. To add an additional assembly
32
+ /// containing sinks, use <code>serilog:using</code>. To set the level use
33
+ /// <code>serilog:minimum-level</code>.
34
+ /// </summary>
35
+ /// <param name="settingConfiguration">Logger setting configuration.</param>
36
+ /// <param name="settingPrefix">Prefix to use when reading keys in appSettings. If specified the value
37
+ /// will be prepended to the setting keys and followed by :, for example "myapp" will use "myapp:serilog:minumum-level. If null
38
+ /// no prefix is applied.</param>
39
+ /// <returns>An object allowing configuration to continue.</returns>
40
+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
41
+ public static LoggerConfiguration AppSettings (
42
+ this LoggerSettingsConfiguration settingConfiguration , string settingPrefix = null )
43
+ {
44
+ return AppSettings ( settingConfiguration , settingPrefix , filePath : null ) ;
45
+ }
46
+
26
47
/// <summary>
27
48
/// Reads the <appSettings> element of App.config or Web.config, searching for for keys
28
49
/// that look like: <code>serilog:*</code>, which are used to configure
0 commit comments