Beispiel #1
0
        public static void WriteLog(LogLevelL4N logLevel, String log)
        {
            if (logLevel.Equals(LogLevelL4N.DEBUG))
            {
                logger.Debug(log);
            }

            else if (logLevel.Equals(LogLevelL4N.ERROR))
            {
                logger.Error(log);
            }

            else if (logLevel.Equals(LogLevelL4N.FATAL))
            {
                logger.Fatal(log);
            }

            else if (logLevel.Equals(LogLevelL4N.INFO))
            {
                logger.Info(log);
            }

            else if (logLevel.Equals(LogLevelL4N.WARN))
            {

                logger.Warn(log);

            }
        }
Beispiel #2
0
 public static void Write(Object Message, LogLevelL4N Level = LogLevelL4N.DEBUG)
 {
     try
     {
         if (Level.Equals(LogLevelL4N.DEBUG))
         {
             _Logger.Debug(Message.ToString());
         }
         else if (Level.Equals(LogLevelL4N.ERROR))
         {
             _Logger.Error(Message.ToString());
         }
         else if (Level.Equals(LogLevelL4N.FATAL))
         {
             _Logger.Fatal(Message.ToString());
         }
         else if (Level.Equals(LogLevelL4N.INFO))
         {
             _Logger.Info(Message.ToString());
         }
         else if (Level.Equals(LogLevelL4N.WARN))
         {
             _Logger.Warn(Message.ToString());
         }
     }
     catch { }
 }
        /// <summary>
        /// It resolves module name and writes log in the file
        /// </summary>
        /// <param name="logLevel"></param>
        /// <param name="log"></param>
        public static void WriteLog(LogLevelL4N logLevel, String log)
        {
            string methodName = new System.Diagnostics.StackFrame(1, true).GetMethod().Name;
            string moduleName = new System.Diagnostics.StackFrame(1, true).GetMethod().ReflectedType.FullName;

            logger = LogManager.GetLogger(moduleName);
            if (logLevel.Equals(LogLevelL4N.DEBUG))
            {
                logger.Debug(" " + methodName + ": " + log);
            }

            else if (logLevel.Equals(LogLevelL4N.ERROR))
            {
                logger.Error(" " + methodName + ": " + log);
            }

            else if (logLevel.Equals(LogLevelL4N.FATAL))
            {
                logger.Fatal(" " + methodName + ": " + log);
            }

            else if (logLevel.Equals(LogLevelL4N.INFO))
            {
                logger.Info(" " + methodName + ": " + log);
            }

            else if (logLevel.Equals(LogLevelL4N.WARN))
            {
                logger.Warn(" " + methodName + ": " + log);
            }
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logLevel"></param>
        /// <param name="log"></param>
        public static void WriteLog(LogLevelL4N logLevel, String log)
        {
            if (logLevel.Equals(LogLevelL4N.DEBUG))
            {
                logger.Debug(log);
            }

            else if (logLevel.Equals(LogLevelL4N.ERROR))
            {
                logger.Error(log);
            }

            else if (logLevel.Equals(LogLevelL4N.FATAL))
            {
                logger.Fatal(log);
            }

            else if (logLevel.Equals(LogLevelL4N.INFO))
            {
                logger.Info(log);
            }

            else if (logLevel.Equals(LogLevelL4N.WARN))
            {
                logger.Warn(log);
            }
        }
 internal static void Write(String Message, LogLevelL4N Level = LogLevelL4N.DEBUG)
 {
     if (Level.Equals(LogLevelL4N.DEBUG))
         _Logger.Debug(Message);
     else if (Level.Equals(LogLevelL4N.ERROR))
         _Logger.Error(Message);
     else if (Level.Equals(LogLevelL4N.FATAL))
         _Logger.Fatal(Message);
     else if (Level.Equals(LogLevelL4N.INFO))
         _Logger.Info(Message);
     else if (Level.Equals(LogLevelL4N.WARN))
         _Logger.Warn(Message);
 }