Skip to content

Commit

Permalink
Cleaned up code in SerilogLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryDungan committed Jul 25, 2017
1 parent e95b856 commit 2457875
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions SerilogLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
using Serilog;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEngine;

namespace RSG
{
public class SerilogLogger : RSG.Utils.ILogger
public class SerilogLogger : Utils.ILogger
{
/// <summary>
/// Serilog logger.
Expand All @@ -27,13 +25,13 @@ public SerilogLogger(LogConfig logConfig, IReflection reflection)
Argument.NotNull(() => logConfig);
Argument.NotNull(() => reflection);

this.EnableVerbose = logConfig.Verbose;
EnableVerbose = logConfig.Verbose;

CreateLogsDirectory();

var loggerConfig = new Serilog.LoggerConfiguration();
var loggerConfig = new LoggerConfiguration();

if (this.EnableVerbose)
if (EnableVerbose)
{
loggerConfig = loggerConfig.MinimumLevel.Verbose();
}
Expand Down Expand Up @@ -72,7 +70,7 @@ public SerilogLogger(LogConfig logConfig, IReflection reflection)
loggerConfig.WriteTo.Sink((Serilog.Core.ILogEventSink)sinkType.GetConstructor(emptyTypeArray).Invoke(emptyObjectArray));
}

this.serilog = loggerConfig.CreateLogger();
serilog = loggerConfig.CreateLogger();

LogInfo("Application started at {TimeNow}", DateTime.Now);
LogInfo("Logs directory status: {LogsDirectoryStatus}", logsDirectoryStatus);
Expand All @@ -85,7 +83,7 @@ public SerilogLogger(LogConfig logConfig, IReflection reflection)
LogInfo("Writing logs and reports to {LogsDirectoryPath}", LogsDirectoryPath);
}

if (this.EnableVerbose)
if (EnableVerbose)
{
LogInfo("Verbose logging is enabled.");
}
Expand Down

0 comments on commit 2457875

Please sign in to comment.