Beispiel #1
0
        // TODO: 09-D 打印日志 WriteDebug, WriteInfo, WriteError, WriteFatal
        /// <summary>
        /// 打印一条新的日志消息
        /// </summary>
        ///     <param name="type">消息类型</param>
        ///     <param name="message">消息的具体内容</param>
        ///     <param name="isDetailMode">详细模式?</param>
        ///     <param name="callerName">调用的方法的名字</param>
        ///     <param name="fileName">调用方法所在的文件名</param>
        ///     <param name="line">调用代码所在行</param>
        /// <returns>[true]->打印成功</returns>
        private static bool WriteLine
        (
            MessageType type,
            string message,
            bool isDetailMode,
            string callerName,
            string fileName,
            int line
        )
        {
            string msg      = BaseLogger.FormatMessage(type, message, isDetailMode, callerName, fileName, line);
            bool   isWrited = false;

            if (Loggers.Any())
            {
                isWrited = true;
                Loggers.ForEach(logger => isWrited &= logger.WriteLine(msg, type));
            }
            return(isWrited);
        }