summaryrefslogtreecommitdiff
path: root/lib/TextLogger.cs
blob: f4207ee62f97949144be251c150df50f46721fc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.IO;
using System.Threading;

namespace jive
{
  public class TextLogger : Logger
  {
    readonly TextWriter writer;

    public TextLogger(TextWriter writer)
    {
      this.writer = writer;
    }

    public void informational(string formatted_string, params object[] arguments)
    {
      writer.WriteLine(formatted_string, arguments);
    }

    public void debug(string formatted_string, params object[] arguments)
    {
      writer.WriteLine("[{0}] - {1}", Thread.CurrentThread.ManagedThreadId,
          formatted_string.format(arguments));
    }

    public void error(Exception e)
    {
      writer.WriteLine("{0}", e);
    }
  }
}