예제 #1
0
        /// <summary>
        /// Logging function
        /// </summary>
        /// <param name="type">Log type;LogTypeEnum</param>
        /// <param name="log">Log data</param>
        public virtual void Log(LogTypeEnum type, string log)
        {
            //if (!IMAPBase.Debug)
            //    return;

            //imapLogActive = true;

            //if (InfoLogged != null)
            //    InfoLogged(type, log);
            IMAPLogger.LogType t = IMAPLogger.LogType.General;

            switch (type)
            {
            case LogTypeEnum.ERROR:
            {
                t = IMAPLogger.LogType.Error;
                break;
            }

            case LogTypeEnum.IMAP:
            {
                t = IMAPLogger.LogType.General;
                break;
            }

            case LogTypeEnum.INFO:
            {
                t = IMAPLogger.LogType.Info;
                break;
            }

            case LogTypeEnum.WARN:
            {
                t = IMAPLogger.LogType.Warning;
                break;
            }
            }

            if (_logger != null)
            {
                _logger.Log(IMAPLogger.LoggingSource.IMAP, t, log);
            }


            //Console.WriteLine(msg);
        }
예제 #2
0
        /// <summary>
        /// Shortcut method for logging information to the Console and optionally, a log file.
        /// </summary>
        /// <param name="type">Type of message</param>
        /// <param name="msg">the message to display</param>
        public void Log(IMAPBase.LogTypeEnum type, string msg)
        {
            IMAPLogger.LogType t = IMAPLogger.LogType.General;

            switch (type)
            {
            case IMAPBase.LogTypeEnum.ERROR:
            {
                t = IMAPLogger.LogType.Error;
                break;
            }

            case IMAPBase.LogTypeEnum.IMAP:
            {
                t = IMAPLogger.LogType.General;
                break;
            }

            case IMAPBase.LogTypeEnum.INFO:
            {
                t = IMAPLogger.LogType.Info;
                break;
            }

            case IMAPBase.LogTypeEnum.WARN:
            {
                t = IMAPLogger.LogType.Warning;
                break;
            }
            }

            if (_logger != null)
            {
                _logger.Log(IMAPLogger.LoggingSource.InterIMAP, t, msg);
            }
        }