123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace SuperSocket.SocketBase.Logging
- {
-
-
-
- public class ConsoleLog : ILog
- {
- private string m_Name;
- private const string m_MessageTemplate = "{0}-{1}: {2}";
- private const string m_Debug = "DEBUG";
- private const string m_Error = "ERROR";
- private const string m_Fatal = "FATAL";
- private const string m_Info = "INFO";
- private const string m_Warn = "WARN";
-
-
-
-
- public ConsoleLog(string name)
- {
- m_Name = name;
- }
-
-
-
-
-
-
- public bool IsDebugEnabled
- {
- get { return true; }
- }
-
-
-
-
-
-
- public bool IsErrorEnabled
- {
- get { return true; }
- }
-
-
-
-
-
-
- public bool IsFatalEnabled
- {
- get { return true; }
- }
-
-
-
-
-
-
- public bool IsInfoEnabled
- {
- get { return true; }
- }
-
-
-
-
-
-
- public bool IsWarnEnabled
- {
- get { return true; }
- }
-
-
-
-
- public void Debug(object message)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, message);
- }
-
-
-
-
-
- public void Debug(object message, Exception exception)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, message + Environment.NewLine + exception.Message + exception.StackTrace);
- }
-
-
-
-
-
- public void DebugFormat(string format, object arg0)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(format, arg0));
- }
-
-
-
-
-
- public void DebugFormat(string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(format, args));
- }
-
-
-
-
-
-
- public void DebugFormat(IFormatProvider provider, string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(provider, format, args));
- }
-
-
-
-
-
-
- public void DebugFormat(string format, object arg0, object arg1)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(format, arg0, arg1));
- }
-
-
-
-
-
-
-
- public void DebugFormat(string format, object arg0, object arg1, object arg2)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(format, arg0, arg1, arg2));
- }
-
-
-
-
- public void Error(object message)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, message);
- }
-
-
-
-
-
- public void Error(object message, Exception exception)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, message + Environment.NewLine + exception.Message + exception.StackTrace);
- }
-
-
-
-
-
- public void ErrorFormat(string format, object arg0)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, string.Format(format, arg0));
- }
-
-
-
-
-
- public void ErrorFormat(string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, string.Format(format, args));
- }
-
-
-
-
-
-
- public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, string.Format(provider, format, args));
- }
-
-
-
-
-
-
- public void ErrorFormat(string format, object arg0, object arg1)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, string.Format(format, arg0, arg1));
- }
-
-
-
-
-
-
-
- public void ErrorFormat(string format, object arg0, object arg1, object arg2)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Error, string.Format(format, arg0, arg2));
- }
-
-
-
-
- public void Fatal(object message)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, message);
- }
-
-
-
-
-
- public void Fatal(object message, Exception exception)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, message + Environment.NewLine + exception.Message + exception.StackTrace);
- }
-
-
-
-
-
- public void FatalFormat(string format, object arg0)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, string.Format(format, arg0));
- }
-
-
-
-
-
- public void FatalFormat(string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, string.Format(format, args));
- }
-
-
-
-
-
-
- public void FatalFormat(IFormatProvider provider, string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, string.Format(provider, format, args));
- }
-
-
-
-
-
-
- public void FatalFormat(string format, object arg0, object arg1)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, string.Format(format, arg0, arg1));
- }
-
-
-
-
-
-
-
- public void FatalFormat(string format, object arg0, object arg1, object arg2)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, string.Format(format, arg0, arg1, arg2));
- }
-
-
-
-
- public void Info(object message)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, message);
- }
-
-
-
-
-
- public void Info(object message, Exception exception)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, message + Environment.NewLine + exception.Message + exception.StackTrace);
- }
-
-
-
-
-
- public void InfoFormat(string format, object arg0)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, string.Format(format, arg0));
- }
-
-
-
-
-
- public void InfoFormat(string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, string.Format(format, args));
- }
-
-
-
-
-
-
- public void InfoFormat(IFormatProvider provider, string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, string.Format(provider, format, args));
- }
-
-
-
-
-
-
- public void InfoFormat(string format, object arg0, object arg1)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, string.Format(format, arg0, arg1));
- }
-
-
-
-
-
-
-
- public void InfoFormat(string format, object arg0, object arg1, object arg2)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Info, string.Format(format, arg0, arg1, arg2));
- }
-
-
-
-
- public void Warn(object message)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, message);
- }
-
-
-
-
-
- public void Warn(object message, Exception exception)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, message + Environment.NewLine + exception.Message + exception.StackTrace);
- }
-
-
-
-
-
- public void WarnFormat(string format, object arg0)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, string.Format(format, arg0));
- }
-
-
-
-
-
- public void WarnFormat(string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, string.Format(format, args));
- }
-
-
-
-
-
-
- public void WarnFormat(IFormatProvider provider, string format, params object[] args)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, string.Format(provider, format, args));
- }
-
-
-
-
-
-
- public void WarnFormat(string format, object arg0, object arg1)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, string.Format(format, arg0, arg1));
- }
-
-
-
-
-
-
-
- public void WarnFormat(string format, object arg0, object arg1, object arg2)
- {
- Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, string.Format(format, arg0, arg1, arg2));
- }
- }
- }
|