- Notifications
You must be signed in to change notification settings - Fork11
Writes Serilog events to the debug output window (in `DEBUG` builds only)
License
serilog/serilog-sinks-debug
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Serilog sink that writes log events toSystem.Diagnostics.Debug (i.e. the Visual Studio debug output window), inDEBUG builds only.
To use the sink, first install theNuGet package:
dotnet add package Serilog.Sinks.Debug
Then enable the sink usingWriteTo.Debug():
Log.Logger=newLoggerConfiguration().WriteTo.Debug().CreateLogger();Log.Information("Hello, world!");
Log events will be printed to the debug output:
To use the sink with theSerilog.Settings.AppSettings package, first install that package if you haven't already done so:
Install-Package Serilog.Settings.AppSettingsInstead of configuring the logger in code, callReadFrom.AppSettings():
varlog=newLoggerConfiguration().ReadFrom.AppSettings().CreateLogger();
In your application'sApp.config orWeb.config file, specify the console sink assembly under the<appSettings> node:
<configuration> <appSettings> <addkey="serilog:using:Debug"value="Serilog.Sinks.Debug" /> <addkey="serilog:write-to:Debug" />
To use the console sink withMicrosoft.Extensions.Configuration, for example with ASP.NET Core or .NET Core, use theSerilog.Settings.Configuration package. First install that package if you have not already done so:
Install-Package Serilog.Settings.ConfigurationInstead of configuring the sink directly in code, callReadFrom.Configuration():
varconfiguration=newConfigurationBuilder().AddJsonFile("appsettings.json").Build();varlogger=newLoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger();
In yourappsettings.json file, under theSerilog node, :
{"Serilog": {"WriteTo": ["Debug"] }}Copyright © 2017 Serilog Contributors - Provided under theApache License, Version 2.0.
About
Writes Serilog events to the debug output window (in `DEBUG` builds only)
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.
