-
Notifications
You must be signed in to change notification settings - Fork 30
Logging
Adam Hellberg edited this page Aug 19, 2016
·
2 revisions
Since v5.0.0, Colore uses System.Diagnostics
for its logging. In order to make sure logging is actually output somewhere, you'll have to configure the logging.
The most common forms of logging are to the console and into a file, so those will be covered here. For more information on System.Diagnostics
logging, please refer to the MSDN article about TraceSource
.
Following is an example App.config
file that will output to both the console and a file called app.log
.
It is configured to output all logging data (threshold set to Verbose
).
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="Default" switchName="DefaultSwitch" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.ConsoleTraceListener">
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" />
</add>
<add name="FileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="log.txt">
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" />
</add>
<remove name="Default" />
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Verbose" />
</switches>
</system.diagnostics>
</configuration>
If you want to output to only the console, or only to a file, simply remove the listener you don't want
(by removing the <add>
tag for that listener).