summaryrefslogtreecommitdiff
path: root/lib/infrastructure/logging/TextLogger.cs
blob: f9dd3ae3283c6f916959cdbe98f7ad33a4773f14 (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
33
using System;
using System.IO;
using System.Threading;
using gorilla.utility;

namespace gorilla.infrastructure.logging
{
    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);
        }
    }
}