-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.cs
More file actions
46 lines (37 loc) · 997 Bytes
/
Logger.cs
File metadata and controls
46 lines (37 loc) · 997 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.IO;
namespace JulMan.Logger
{
public sealed class Logger
{
private StreamType st;
private StreamWriter sw;
private TextWriter tw;
public Logger(Stream stream)
{
this.st = StreamType.Stream;
this.sw = new StreamWriter(stream);
}
public Logger(StreamWriter stream)
{
this.st = StreamType.Stream;
this.sw = stream;
}
public Logger(TextWriter stream)
{
this.st = StreamType.TextWriter;
this.tw = stream;
}
public StreamWriter GetStream()
{
if (st == StreamType.Stream) return sw;
return null;
}
public TextWriter GetTextWriter()
{
if (st == StreamType.TextWriter) return tw;
return null;
}
public SubLogger CreateSubLogger(string prefix) => new SubLogger(this, st, prefix);
}
}