コード例 #1
0
        /// <summary>
        /// Writes the log.
        /// </summary>
        /// <param name="exception">The exception</param>
        /// <param name="logName">The name</param>
        public static void WriteLog(this Exception exception, string logName)
        {
            var log = LogUtility.GetInstance().GetLog(logName);

            if (log == null)
            {
                return;
            }

            log.Error(exception);
        }
コード例 #2
0
        public static void WriteLog(this string message, string name, Log4NetType logType)
        {
            var log = LogUtility.GetInstance().GetLog(name);

            if (log == null)
            {
                return;
            }

            switch (logType)
            {
            case Log4NetType.Debug:
                log.Debug(message);
                break;

            case Log4NetType.Error:
                log.Error(message);
                break;

            case Log4NetType.Fatal:
                log.Fatal(message);
                break;

            case Log4NetType.Info:
                log.Info(message);
                break;

            case Log4NetType.Warn:
                log.Warn(message);
                break;

            default:
                log.Warn(message);
                break;
            }
        }