Suggestion: Define and implement an ILog interface like log4net

May 20, 2013 at 10:36 AM
Hi,
i would like to suggest that in this great project you define and implement an ILog interface like the one that you can find on similar tools like log4net.
public interface ILog : ILoggerWrapper
{
    void Debug(object message);
    void Debug(object message, Exception exception);
    void DebugFormat(string format, object arg0);
    void DebugFormat(string format, params object[] args);
    void DebugFormat(IFormatProvider provider, string format, params object[] args);
    void DebugFormat(string format, object arg0, object arg1);
    void DebugFormat(string format, object arg0, object arg1, object arg2);
    void Error(object message);
    void Error(object message, Exception exception);
    void ErrorFormat(string format, params object[] args);
    void ErrorFormat(string format, object arg0);
    void ErrorFormat(IFormatProvider provider, string format, params object[] args);
    void ErrorFormat(string format, object arg0, object arg1);
    void ErrorFormat(string format, object arg0, object arg1, object arg2);
    void Fatal(object message);
    void Fatal(object message, Exception exception);
    void FatalFormat(string format, params object[] args);
    void FatalFormat(string format, object arg0);
    void FatalFormat(IFormatProvider provider, string format, params object[] args);
    void FatalFormat(string format, object arg0, object arg1);
    void FatalFormat(string format, object arg0, object arg1, object arg2);
    void Info(object message);
    void Info(object message, Exception exception);
    void InfoFormat(string format, params object[] args);
    void InfoFormat(string format, object arg0);
    void InfoFormat(IFormatProvider provider, string format, params object[] args);
    void InfoFormat(string format, object arg0, object arg1);
    void InfoFormat(string format, object arg0, object arg1, object arg2);
    void Warn(object message);
    void Warn(object message, Exception exception);
    void WarnFormat(string format, object arg0);
    void WarnFormat(string format, params object[] args);
    void WarnFormat(IFormatProvider provider, string format, params object[] args);
    void WarnFormat(string format, object arg0, object arg1);
    void WarnFormat(string format, object arg0, object arg1, object arg2);

    bool IsDebugEnabled { get; }

    bool IsErrorEnabled { get; }

    bool IsFatalEnabled { get; }

    bool IsInfoEnabled { get; }

    bool IsWarnEnabled { get; }
}
Thanks.
Stefano
Coordinator
Dec 6 at 11:23 PM
Couple of questions...

1) Do you still want this (after 1.5 years)?

2) Do you want the ILog interface in TracerX to be exactly the same as what you posted, or do you want it to match the existing TracerX.Logger class (easiest for me), or some combination?

It might help if I understood the reason for having it. If it's a way to switch easily between different implementations (e.g. TracerX vs. NLog vs. Log4Net), then it can only expose features that are common to all the implementations, right? So that would mean no Verbose log level and no "call" logging (e.g. InfoCall(), DebugCall(), etc.) because those features are only implemented by TracerX (I think).
Dec 8 at 9:37 AM
Hi, thanks for the reply.
what i mean is the capability of easily switch from others log and TracerX.
And i think that will be great the support of Common.Logging infrastructure
http://netcommon.sourceforge.net
so that anyone would like to use the entire power of TracerX could use it as usual while if someone need the "switchability" of log they could use the Common.Logging infrastructure.
Thanks again
Coordinator
Dec 9 at 2:17 AM
It would be easy enough for me to implement the ILog from Log4Net that you posted earlier, as long as it does not include ILoggerWrapper. Would that be acceptable?

Or would you prefer that I implement the ILog from Common.Logging? I'm not interested in providing full support for Common.Logging, but I could implement its ILog.