private LogEntry(DateTime date, string message, LogMeta meta, object raw) { LogDate = date; Message = message; MetaData = meta; RawObject = raw; }
private LogEntry( DateTime date, string message, LogMeta meta, object raw ) { LogDate = date; Message = message; MetaData = meta; RawObject = raw; }
/// <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; }
/// <summary> /// 获取日志类型信息 /// </summary> /// <param name="metaData"></param> /// <returns></returns> public static LogType LogType(this LogMeta metaData) { if (metaData == null) { return(null); } return(metaData.GetMetaData <LogType>()); }
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); }
/// <summary> /// 从既有的元数据创建 LogMeta 对象 /// </summary> /// <param name="metaData">既有的元数据</param> public LogMeta(LogMeta metaData) { data = new Dictionary <Type, object>(metaData.data); }
/// <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) { }
/// <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) { }