Skip to content

Commit

Permalink
[CHG] Move IsDebuggerAttached to DebugLogger from Terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
geoperez committed Sep 13, 2019
1 parent a2d0fb8 commit ced960b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Swan.Lite/Logging/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected ConsoleLogger()
public static ConsoleColor FatalColor { get; set; } = ConsoleColor.Red;

/// <inheritdoc />
public LogLevel LogLevel { get; set; } = Terminal.IsDebuggerAttached ? LogLevel.Trace : LogLevel.Info;
public LogLevel LogLevel { get; set; } = DebugLogger.IsDebuggerAttached ? LogLevel.Trace : LogLevel.Info;

/// <inheritdoc />
public void Log([NotNull] LogMessageReceivedEventArgs logEvent)
Expand Down
10 changes: 9 additions & 1 deletion src/Swan.Lite/Logging/DebugLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ protected DebugLogger()
{
// Empty
}

/// <summary>
/// Gets a value indicating whether a debugger is attached.
/// </summary>
/// <value>
/// <c>true</c> if this instance is debugger attached; otherwise, <c>false</c>.
/// </value>
public static bool IsDebuggerAttached => System.Diagnostics.Debugger.IsAttached;

/// <inheritdoc/>
public LogLevel LogLevel { get; set; } = Terminal.IsDebuggerAttached ? LogLevel.Trace : LogLevel.None;
public LogLevel LogLevel { get; set; } = IsDebuggerAttached ? LogLevel.Trace : LogLevel.None;

internal static DebugLogger Instance { get; } = new DebugLogger();

Expand Down
2 changes: 1 addition & 1 deletion src/Swan.Lite/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static Logger()
if (Terminal.IsConsolePresent)
Loggers.Add(ConsoleLogger.Instance);

if (Terminal.IsDebuggerAttached)
if (DebugLogger.IsDebuggerAttached)
Loggers.Add(DebugLogger.Instance);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Swan.Lite/Swan.Lite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Swan.Lite</AssemblyName>
<CodeAnalysisRuleSet>..\..\StyleCop.Analyzers.ruleset</CodeAnalysisRuleSet>
<Version>2.1.0</Version>
<Version>2.2.0</Version>
<Authors>Unosquare</Authors>
<PackageIconUrl>https://github.com/unosquare/swan/raw/master/swan-logo-32.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/unosquare/swan</PackageProjectUrl>
Expand Down
8 changes: 0 additions & 8 deletions src/Swan.Lite/Terminal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ public static bool IsConsolePresent
}
}

/// <summary>
/// Gets a value indicating whether a debugger is attached.
/// </summary>
/// <value>
/// <c>true</c> if this instance is debugger attached; otherwise, <c>false</c>.
/// </value>
public static bool IsDebuggerAttached => System.Diagnostics.Debugger.IsAttached;

/// <summary>
/// Gets the available output writers in a bitwise mask.
/// </summary>
Expand Down

0 comments on commit ced960b

Please sign in to comment.