/// <summary> /// 实时添加日志并抛出异常 /// </summary> /// <param name="error">错误异常</param> /// <param name="message">提示信息</param> /// <param name="cache">缓存类型</param> public void ThrowReal(Exception error, string message, cacheType cache) { if (error != null && error.Message.StartsWith(ExceptionPrefix, StringComparison.Ordinal)) { error = null; } if (error == null) { if (message != null) { ThrowReal(message, null, cache); } } else { debug value = new debug { Exception = error, Message = message }; if (cache == cacheType.None || checkCache(value, cache == cacheType.Queue)) { realOutput(value); } throw error != null ? new Exception(ExceptionPrefix + message, error) : new Exception(ExceptionPrefix + message); } }
/// <summary> /// 添加日志 /// </summary> /// <param name="error">错误异常</param> /// <param name="message">提示信息</param> /// <param name="cache">缓存类型</param> public void Add(Exception error, string message, cacheType cache) { if (error != null && error.Message.StartsWith(ExceptionPrefix, StringComparison.Ordinal)) { error = null; } if (error == null) { if (message != null) { Add(message, null, cache); } } else { debug value = new debug { Exception = error, Message = message }; if (cache == cacheType.None || checkCache(value, cache == cacheType.Queue)) { queue.EnqueueNotNull(value); } } }
/// <summary> /// 实时添加日志 /// </summary> /// <param name="message">提示信息</param> /// <param name="stackFrame">堆栈帧函数信息</param> /// <param name="cache">缓存类型</param> public void Real(string message, StackFrame stackFrame, cacheType cache) { debug value = new debug { StackTrace = stackFrame == null ? new StackTrace(true) : null, StackFrame = stackFrame, Message = message }; if (cache == cacheType.None || checkCache(value, cache == cacheType.Queue)) { realOutput(value); } }
/// <summary> /// 添加日志 /// </summary> /// <param name="message">提示信息</param> /// <param name="stackFrame">堆栈帧函数信息</param> /// <param name="cache">缓存类型</param> public void Add(string message, StackFrame stackFrame, cacheType cache) { debug value = new debug { StackTrace = stackFrame == null ? new StackTrace(true) : null, StackFrame = stackFrame, Message = message }; if (cache == cacheType.None || checkCache(value, cache == cacheType.Queue)) { queue.EnqueueNotNull(value); } }
/// <summary> /// 添加日志并抛出异常 /// </summary> /// <param name="message">提示信息</param> /// <param name="stackFrame">堆栈帧函数信息</param> /// <param name="cache">缓存类型</param> public void Throw(string message, StackFrame stackFrame, cacheType cache) { debug value = new debug { StackTrace = stackFrame == null ? new StackTrace(true) : null, StackFrame = stackFrame, Message = message }; if (cache == cacheType.None || checkCache(value, cache == cacheType.Queue)) { queue.EnqueueNotNull(value); } throw new Exception(ExceptionPrefix + message); }