summaryrefslogtreecommitdiff
path: root/code/common/Logging.cs
diff options
context:
space:
mode:
Diffstat (limited to 'code/common/Logging.cs')
-rw-r--r--code/common/Logging.cs30
1 files changed, 2 insertions, 28 deletions
diff --git a/code/common/Logging.cs b/code/common/Logging.cs
index 4afa631..e1db1bf 100644
--- a/code/common/Logging.cs
+++ b/code/common/Logging.cs
@@ -1,44 +1,18 @@
using System;
-using System.IO;
using System.Reflection;
namespace common
{
static public class Logging
{
- static public Logger log<T>(this T item)
- {
- return new TextLogger(Console.Out);
- }
-
static public void log(this string item, params object[] arguments)
{
- new TextLogger(Console.Out).debug(item, arguments);
+ Console.Out.WriteLine("{0}: {1}".format(Assembly.GetEntryAssembly().GetName().Name, item.format(arguments)));
}
static public void add_to_log(this Exception item)
{
- new TextLogger(Console.Out).debug(item.Message);
+ item.Message.log();
}
}
-
- public class TextLogger : Logger
- {
- readonly TextWriter writer;
-
- public TextLogger(TextWriter writer)
- {
- this.writer = writer;
- }
-
- public void debug(string message, params object[] arguments)
- {
- writer.WriteLine("{0}: {1}".format(Assembly.GetEntryAssembly().GetName().Name, message.format(arguments)));
- }
- }
-
- public interface Logger
- {
- void debug(string message, params object[] arguments);
- }
} \ No newline at end of file