/// <summary>
 /// 创建事件生成器
 /// </summary>
 private EventBuilder CreateBuilder(LogLevel level, ILogContent content)
 {
     if (content.Exception != null)
     {
         return(_client.CreateException(content.Exception));
     }
     return(_client.CreateLog(GetMessage(content), ConvertTo(level)));
 }
        /// <summary>
        /// Submits an exception event.
        /// </summary>
        /// <param name="client">The client instance.</param>
        /// <param name="exception">The exception.</param>
        public static void SubmitException(this ExceptionlessClient client, Exception exception)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            client.CreateException(exception).Submit();
        }
        /// <summary>
        /// 创建事件生成器
        /// </summary>
        private EventBuilder CreateBuilder(LogLevel level, ILogContent content)
        {
            if (content.Exception != null && (level == LogLevel.Error || level == LogLevel.Critical))
            {
                return(_client.CreateException(content.Exception));
            }
            var builder = _client.CreateLog(GetMessage(content), ConvertTo(level));

            if (content.Exception != null && level == LogLevel.Warning)
            {
                builder.SetException(content.Exception);
            }
            return(builder);
        }
Example #4
0
 /// <summary>
 /// Submits an exception event.
 /// </summary>
 /// <param name="client">The client instance.</param>
 /// <param name="exception">The exception.</param>
 public static void SubmitException(this ExceptionlessClient client, Exception exception)
 {
     client.CreateException(exception).Submit();
 }