예제 #1
0
 private LogEntry(DateTime date, string message, LogMeta meta, object raw)
 {
     LogDate   = date;
     Message   = message;
     MetaData  = meta;
     RawObject = raw;
 }
예제 #2
0
 private LogEntry( DateTime date, string message, LogMeta meta, object raw )
 {
     LogDate = date;
       Message = message;
       MetaData = meta;
       RawObject = raw;
 }
예제 #3
0
        /// <summary>
        /// 创建一条日志记录
        /// </summary>
        /// <param name="message">日志消息</param>
        /// <param name="scope">当前所处的范畴</param>
        /// <param name="raw">日志记录的原始对象</param>
        public LogEntry( string message, LogMeta meta = null, object raw = null )
        {
            LogDate = DateTime.UtcNow;
              MetaData = meta ?? LogMeta.Blank;

              Message = message;
              RawObject = raw;
        }
예제 #4
0
        /// <summary>
        /// 获取日志类型信息
        /// </summary>
        /// <param name="metaData"></param>
        /// <returns></returns>
        public static LogType LogType(this LogMeta metaData)
        {
            if (metaData == null)
            {
                return(null);
            }

            return(metaData.GetMetaData <LogType>());
        }
예제 #5
0
        private static LogMeta GetLogMeta(Logger logger, LogType type)
        {
            Contract.Assert(logger != null);

            var meta = LogMeta.GetDefaultMeta().SetMetaData(type);


            var provider = logger as ILogMetaProvider;

            if (provider != null)
            {
                meta = provider.GetLogMeta(meta);
            }

            return(meta);
        }
예제 #6
0
 /// <summary>
 /// 从既有的元数据创建 LogMeta 对象
 /// </summary>
 /// <param name="metaData">既有的元数据</param>
 public LogMeta(LogMeta metaData)
 {
     data = new Dictionary <Type, object>(metaData.data);
 }
예제 #7
0
 /// <summary>
 /// 创建一条日志记录
 /// </summary>
 /// <param name="message">日志消息</param>
 /// <param name="meta">日志元数据</param>
 /// <param name="raw">日志记录的原始对象</param>
 public LogEntry( string message, LogMeta meta = null, object raw = null )
     : this(DateTime.UtcNow, message, meta ?? LogMeta.GetDefaultMeta(), raw)
 {
 }
예제 #8
0
 /// <summary>
 /// 创建一条日志记录
 /// </summary>
 /// <param name="message">日志消息</param>
 /// <param name="meta">日志元数据</param>
 /// <param name="raw">日志记录的原始对象</param>
 public LogEntry(string message, LogMeta meta = null, object raw = null) : this(DateTime.UtcNow, message, meta ?? LogMeta.GetDefaultMeta(), raw)
 {
 }