Minor reorganization of html filter code.
[beagle.git] / bludgeon / Log.cs
blobd67f8e6dd52ac42e415da7dcbb47b798cab50982
2 using System;
3 using System.IO;
4 using System.Text;
6 namespace Bludgeon {
8 public class Log {
10 static TextWriter console = Console.Out;
11 static TextWriter file = null;
13 static private void Write (string prefix, string format, params object [] args)
15 StringBuilder builder;
16 builder = new StringBuilder ();
17 builder.AppendFormat ("{0:yyMMdd HHmmssffff} ", DateTime.Now);
18 builder.Append (prefix);
19 builder.Append (' ');
20 builder.AppendFormat (format, args);
22 string message;
23 message = builder.ToString ();
25 if (console != null)
26 console.WriteLine (message);
28 if (file != null) {
29 file.WriteLine (message);
30 file.Flush ();
34 static public void Create (string path)
36 file = new StreamWriter (path);
39 static public void Spew (string format, params object [] args)
41 Write ("---", format, args);
44 static public void Info (string format, params object [] args)
46 Write ("+++", format, args);
49 static public void Failure (string format, params object [] args)
51 Write ("***", format, args);