Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DebugLogger usable by not stripping Debug.WriteLine #160

Merged
merged 1 commit into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Splat/DebugLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Taken from https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Debug

// We need to define the DEBUG symbol because we want the logger
// to work even when this package is compiled on release. Otherwise,
// the call to Debug.WriteLine will not be in the release binary
#define DEBUG

namespace Splat
{
public class DebugLogger : ILogger
{
public void Write(string message, LogLevel logLevel)
{
if ((int)logLevel < (int)Level) return;
System.Diagnostics.Debug.WriteLine(message);
}

public LogLevel Level { get; set; }
}
}
13 changes: 0 additions & 13 deletions src/Splat/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Globalization;
using System.Text;
using System.Threading;
using System.Diagnostics;
using System.Diagnostics.Contracts;

namespace Splat
Expand Down Expand Up @@ -159,18 +158,6 @@ public class NullLogger : ILogger
public LogLevel Level { get; set; }
}

public class DebugLogger : ILogger
{
public void Write(string message, LogLevel logLevel)
{
if ((int)logLevel < (int)Level) return;
Debug.WriteLine(message);
}

public LogLevel Level { get; set; }
}


/*
* LogHost / Logging Mixin
*/
Expand Down