-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
using System; | ||
using Serilog; | ||
using NLog; | ||
using System; | ||
|
||
namespace SvnSummaryTool | ||
{ | ||
public static class LogHelper | ||
{ | ||
private static Logger _Logger = null; | ||
public static void InitLog() | ||
{ | ||
Log.Logger = new LoggerConfiguration() | ||
# if DEBUG | ||
.MinimumLevel.Debug() | ||
#else | ||
.MinimumLevel.Information() | ||
#endif | ||
.WriteTo.File(@"logs\log.txt") | ||
.CreateLogger(); | ||
_Logger = LogManager.GetCurrentClassLogger(); | ||
} | ||
|
||
public static void Info(string info) => Serilog.Log.Information(info); | ||
public static void Info(string info) => _Logger.Info(info); | ||
|
||
public static void Debug(string info) => Serilog.Log.Debug(info); | ||
public static void Debug(string info) => _Logger.Debug(info); | ||
|
||
public static void Error(string msg, Exception e) => Serilog.Log.Error(msg, e); | ||
public static void Error(string msg, Exception e) => _Logger.Error(msg, e); | ||
|
||
public static void Close() | ||
{ | ||
Serilog.Log.CloseAndFlush(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema--> | ||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
autoReload="true" | ||
internalLogFile="%TEMP%\svn-diff-internal.log" | ||
internalLogLevel="Info" > | ||
|
||
<!-- the targets to write to --> | ||
<targets> | ||
<!-- write logs to file --> | ||
<target xsi:type="File" name="logfile" fileName="${CurrentDir}\Logs\${shortdate}.log" | ||
layout="${longdate}|${level}|${message} |${all-event-properties} ${exception:format=tostring}" /> | ||
<!--<target xsi:type="Console" name="logconsole" | ||
layout="${longdate}|${level}|${message} |${all-event-properties} ${exception:format=tostring}" />--> | ||
</targets> | ||
|
||
<!-- rules to map from logger name to target --> | ||
<rules> | ||
<logger name="*" minlevel="Trace" writeTo="logfile,logconsole" /> | ||
</rules> | ||
</nlog> |