update ninject to 3.3.1 to attempt compatibility with mono framework. switch ninject config to use logfile logger not nlog..for now..
123 lines
3.2 KiB
C#
123 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Interfaces;
|
|
|
|
namespace CardReaderService.DefaultComponents
|
|
{
|
|
class LogFileLogger: ILogger
|
|
{
|
|
public bool IsDebugEnabled => true;
|
|
public bool IsErrorEnabled => true;
|
|
public bool IsFatalEnabled => true;
|
|
public bool IsInfoEnabled => true;
|
|
public bool IsTraceEnabled => true;
|
|
public bool IsWarnEnabled => true;
|
|
|
|
public void Debug(Exception exception)
|
|
{
|
|
Log(exception.ToString());
|
|
}
|
|
|
|
public void Debug(string format, params object[] args)
|
|
{
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Debug(Exception exception, string format, params object[] args)
|
|
{
|
|
Log(exception.ToString());
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Error(Exception exception)
|
|
{
|
|
Log(exception.ToString());
|
|
}
|
|
|
|
public void Error(string format, params object[] args)
|
|
{
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Error(Exception exception, string format, params object[] args)
|
|
{
|
|
Log(exception.ToString());
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Fatal(Exception exception)
|
|
{
|
|
Log(exception.ToString());
|
|
}
|
|
|
|
public void Fatal(string format, params object[] args)
|
|
{
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Fatal(Exception exception, string format, params object[] args)
|
|
{
|
|
Log(exception.ToString());
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Info(Exception exception)
|
|
{
|
|
Log(exception.ToString());
|
|
}
|
|
|
|
public void Info(string format, params object[] args)
|
|
{
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Info(Exception exception, string format, params object[] args)
|
|
{
|
|
Log(exception.ToString());
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Trace(Exception exception)
|
|
{
|
|
Log(exception.ToString());
|
|
}
|
|
|
|
public void Trace(string format, params object[] args)
|
|
{
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Trace(Exception exception, string format, params object[] args)
|
|
{
|
|
Log(exception.ToString());
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Warn(Exception exception)
|
|
{
|
|
Log(exception.ToString());
|
|
}
|
|
|
|
public void Warn(string format, params object[] args)
|
|
{
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
public void Warn(Exception exception, string format, params object[] args)
|
|
{
|
|
Log(exception.ToString());
|
|
Log(string.Format(format, args));
|
|
}
|
|
|
|
private static string _logPath = "log.txt";
|
|
|
|
public static void Log(string message)
|
|
{
|
|
System.IO.File.WriteAllText(_logPath, string.Format("{0} | {1}", DateTime.Now, message));
|
|
}
|
|
}
|
|
}
|