@@ -65,8 +65,9 @@ Root section name can be changed:
65
65
```
66
66
67
67
``` csharp
68
+ var context = new ConfigurationContext { SectionName = " CustomSection" };
68
69
var logger = new LoggerConfiguration ()
69
- .ReadFrom .Configuration (configuration , sectionName : " CustomSection " )
70
+ .ReadFrom .Configuration (configuration , context )
70
71
.CreateLogger ();
71
72
```
72
73
@@ -106,8 +107,9 @@ In case of [non-standard](#azure-functions-v2-v3) dependency management you can
106
107
``` csharp
107
108
var functionDependencyContext = DependencyContext .Load (typeof (Startup ).Assembly );
108
109
110
+ var context = new ConfigurationContext (functionDependencyContext ) { SectionName = " AzureFunctionsJobHost:Serilog" };
109
111
var logger = new LoggerConfiguration ()
110
- .ReadFrom .Configuration (hostConfig , sectionName : " AzureFunctionsJobHost:Serilog " , dependencyContext : functionDependencyContext )
112
+ .ReadFrom .Configuration (hostConfig , context )
111
113
.CreateLogger ();
112
114
```
113
115
@@ -119,8 +121,9 @@ var configurationAssemblies = new[]
119
121
typeof (ConsoleLoggerConfigurationExtensions ).Assembly ,
120
122
typeof (FileLoggerConfigurationExtensions ).Assembly ,
121
123
};
124
+ var context = new ConfigurationContext (configurationAssemblies );
122
125
var logger = new LoggerConfiguration ()
123
- .ReadFrom .Configuration (configuration , configurationAssemblies )
126
+ .ReadFrom .Configuration (configuration , context )
124
127
.CreateLogger ();
125
128
```
126
129
@@ -376,9 +379,9 @@ public class Startup : FunctionsStartup
376
379
{
377
380
var functionDependencyContext = DependencyContext .Load (typeof (Startup ).Assembly );
378
381
379
- var hostConfig = sp . GetRequiredService < IConfiguration >() ;
382
+ var context = new ConfigurationContext ( functionDependencyContext ) { SectionName = " AzureFunctionsJobHost:Serilog " } ;
380
383
var logger = new LoggerConfiguration ()
381
- .ReadFrom .Configuration (hostConfig , sectionName : " AzureFunctionsJobHost:Serilog " , dependencyContext : functionDependencyContext )
384
+ .ReadFrom .Configuration (hostConfig , context )
382
385
.CreateLogger ();
383
386
384
387
return new SerilogLoggerProvider (logger , dispose : true );
0 commit comments