Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt committed May 30, 2016
1 parent eacdf64 commit 834eae6
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/Serilog/Debugging/SelfLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,38 @@ namespace Serilog.Debugging
/// </summary>
public static class SelfLog
{
static readonly Action<string> _output;

/// <summary>
/// The output mechanism for self-log events.
/// </summary>
/// <example>
/// SelfLog.Out = Console.Error;
/// </example>
// ReSharper disable once MemberCanBePrivate.Global, UnusedAutoPropertyAccessor.Global
public static TextWriter Out { get; set; }
[Obsolete("Use SetOutput() instead")]
public static TextWriter Out
{
set
{
if (value == null)
{
SetOutput(null);
}
else
{
SetOutput(m =>
{
value.WriteLine(DateTime.UtcNow.ToString("o") + " " + m);
value.Flush();
});
}
}
}

public static void SetOutput(Action<string> output)
{
}

/// <summary>
/// Write a message to the self-log.
Expand All @@ -41,11 +65,10 @@ public static class SelfLog
/// <param name="arg2">Third argument, if supplied.</param>
public static void WriteLine(string format, object arg0 = null, object arg1 = null, object arg2 = null)
{
var o = Out;
var o = _output;
if (o != null)
{
o.WriteLine(DateTime.Now.ToString("s") + " " + format, arg0, arg1, arg2);
o.Flush();
o(string.Format(format, arg0, arg1, arg2));
}
}
}
Expand Down

0 comments on commit 834eae6

Please sign in to comment.