diff --git a/ExtremelySimpleLogger/ConsoleSink.cs b/ExtremelySimpleLogger/ConsoleSink.cs index 36d89d6..c3f4e33 100644 --- a/ExtremelySimpleLogger/ConsoleSink.cs +++ b/ExtremelySimpleLogger/ConsoleSink.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using System.IO; namespace ExtremelySimpleLogger { /// - /// A that writes log output to . + /// A that writes log output to or . /// public class ConsoleSink : Sink { @@ -17,6 +18,15 @@ namespace ExtremelySimpleLogger { {LogLevel.Fatal, ConsoleColor.DarkRed} }; private readonly object locker = new object(); + private readonly TextWriter console; + + /// + /// Creates a new console sink with the given settings. + /// + /// Whether to log to instead of . + public ConsoleSink(bool error = false) { + this.console = error ? Console.Error : Console.Out; + } /// /// Sets the that text with the given should be displayed with. @@ -57,11 +67,11 @@ namespace ExtremelySimpleLogger { var color = this.GetColor(level); if (color.HasValue) Console.ForegroundColor = color.Value; - Console.WriteLine(s); + this.console.WriteLine(s); if (color.HasValue) Console.ResetColor(); } } } -} \ No newline at end of file +}