public class LogMgr
{
private static ILog log = LogManager.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType);
public static string LogPosition()
{
StackTrace st = new StackTrace();
StackFrame sf = st.GetFrame(1);
return "Position:" + sf.GetMethod().DeclaringType.Name+"["+sf.GetMethod().Name+"]\r\n";
}
public void Error(string message)
{
log.Error(LogPosition()+message);
}
public void Debug(string message)
{
log.Debug(LogPosition()+ message);
}
public void Info(string message)
{
log.Info(message);
}
public void Warn(string message)
{
log.Warn(message);
}
}