Ejemplo n.º 1
0
        /// <summary>
        /// 创建一个日志记录器,对于所有的日志添加日志源信息
        /// </summary>
        /// <param name="logger">内部日志记录器,将使用这个日志记录器进行实际的日志记录</param>
        /// <param name="source">要添加的日志源信息</param>
        /// <returns>会自动添加日志源信息的日志记录器</returns>
        public static Logger WithSource( this Logger logger, LogSource source )
        {
            if ( logger == null )
            return null;

              if ( source == null )
            throw new ArgumentNullException( "source" );

              return new LoggerWithSource( logger, source );
        }
        /// <summary>
        /// 创建一个日志记录器,对于所有的日志添加日志源信息
        /// </summary>
        /// <param name="logger">内部日志记录器,将使用这个日志记录器进行实际的日志记录</param>
        /// <param name="source">要添加的日志源信息</param>
        /// <returns>会自动添加日志源信息的日志记录器</returns>
        public static Logger WithSource(this Logger logger, LogSource source)
        {
            if (logger == null)
            {
                return(null);
            }

            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            return(new LoggerWithSource(logger, source));
        }
Ejemplo n.º 3
0
 public LoggerWithSource( Logger logger, LogSource source )
 {
     Contract.Assert( logger != null );
     Contract.Assert( source != null );
     Source = source;
 }
 public LoggerWithSource(Logger logger, LogSource source)
 {
     Contract.Assert(logger != null);
     Contract.Assert(source != null);
     Source = source;
 }