You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-32Lines changed: 6 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
Serilog logging for _Microsoft.Extensions.Hosting_. This package routes framework log messages through Serilog, so you can get information about the framework's internal operations written to the same Serilog sinks as your application events.
4
4
5
+
**ASP.NET Core** applications should consider [using _Serilog.AspNetCore_ instead](https://github.com/serilog/serilog-aspnetcore), which bundles this package and includes other ASP.NET Core-specific features.
6
+
5
7
### Instructions
6
8
7
9
**First**, install the _Serilog.Extensions.Hosting_[NuGet package](https://www.nuget.org/packages/Serilog.Extensions.Hosting) into your app. You will need a way to view the log messages - _Serilog.Sinks.Console_ writes these to the console; there are [many more sinks available](https://www.nuget.org/packages?q=Tags%3A%22serilog%22) on NuGet.
@@ -63,7 +65,7 @@ That's it! You will see log output like:
63
65
[22:10:39 INF] The current time is: 12/05/2018 10:10:39 +00:00
64
66
```
65
67
66
-
A more complete example, showing _appsettings.json_ configuration, can be found in [the sample project here](https://github.com/serilog/serilog-hostinh/tree/dev/samples/SimpleServiceSample).
68
+
A more complete example, showing _appsettings.json_ configuration, can be found in [the sample project here](https://github.com/serilog/serilog-hosting/tree/dev/samples/SimpleServiceSample).
67
69
68
70
### Using the package
69
71
@@ -78,39 +80,11 @@ You can alternatively configure Serilog using a delegate as shown below:
This has the advantage of making the `hostingContext`'s `Configuration` object available for configuration of the logger, but at the expense of recording `Exception`s raised earlier in program startup.
87
89
88
90
If this method is used, `Log.Logger` is assigned implicitly, and closed when the app is shut down.
89
-
90
-
### Writing to the Azure Diagnostics Log Stream
91
-
92
-
The Azure Diagnostic Log Stream ships events from any files in the `D:\home\LogFiles\` folder. To enable this for your app, first install the _Serilog.Sinks.File_ package:
93
-
94
-
```powershell
95
-
Install-Package Serilog.Sinks.File
96
-
```
97
-
98
-
Then add a file sink to your `LoggerConfiguration`, taking care to set the `shared` and `flushToDiskInterval` parameters:
0 commit comments