/// <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>
        /// Creates a log message event.
        /// </summary>
        /// <param name="client">The client instance.</param>
        /// <param name="source">The log source.</param>
        /// <param name="message">The log message.</param>
        public static EventBuilder CreateLog(this ExceptionlessClient client, string source, string message)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            return(client.CreateLog(message).SetSource(source));
        }
        /// <summary>
        /// Submits a log message event.
        /// </summary>
        /// <param name="client">The client instance.</param>
        /// <param name="message">The log message.</param>
        /// <param name="level">The log level.</param>
        public static void SubmitLog(this ExceptionlessClient client, string message, LogLevel level)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            client.CreateLog(null, message, level.ToString()).Submit();
        }
        /// <summary>
        /// Submits a log message event.
        /// </summary>
        /// <param name="client">The client instance.</param>
        /// <param name="source">The log source.</param>
        /// <param name="message">The log message.</param>
        /// <param name="level">The log level.</param>
        public static void SubmitLog(this ExceptionlessClient client, string source, string message, string level)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            client.CreateLog(source, message, level).Submit();
        }
예제 #5
0
        /// <summary>
        /// Creates a log message event.
        /// </summary>
        /// <param name="client">The client instance.</param>
        /// <param name="source">The log source.</param>
        /// <param name="message">The log message.</param>
        /// <param name="level">The log level.</param>
        public static EventBuilder CreateLog(this ExceptionlessClient client, string source, string message, string level)
        {
            var builder = client.CreateLog(source, message);

            if (!String.IsNullOrWhiteSpace(level))
            {
                builder.AddObject(level.Trim(), Event.KnownDataKeys.Level);
            }

            return(builder);
        }
        /// <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);
        }
        /// <summary>
        /// Creates a log message event.
        /// </summary>
        /// <param name="client">The client instance.</param>
        /// <param name="source">The log source.</param>
        /// <param name="message">The log message.</param>
        /// <param name="level">The log level.</param>
        public static EventBuilder CreateLog(this ExceptionlessClient client, string source, string message, string level)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            var builder = client.CreateLog(source, message);

            if (!String.IsNullOrWhiteSpace(level))
            {
                builder.SetProperty(Event.KnownDataKeys.Level, level.Trim());
            }

            return(builder);
        }
예제 #8
0
 /// <summary>
 /// Submits a log message event.
 /// </summary>
 /// <param name="client">The client instance.</param>
 /// <param name="source">The log source.</param>
 /// <param name="message">The log message.</param>
 /// <param name="level">The log level.</param>
 public static void SubmitLog(this ExceptionlessClient client, string source, string message, LogLevel level)
 {
     client.CreateLog(source, message, level.ToString()).Submit();
 }
예제 #9
0
 /// <summary>
 /// Submits a log message event.
 /// </summary>
 /// <param name="client">The client instance.</param>
 /// <param name="source">The log source.</param>
 /// <param name="message">The log message.</param>
 public static void SubmitLog(this ExceptionlessClient client, string source, string message)
 {
     client.CreateLog(source, message).Submit();
 }
예제 #10
0
 /// <summary>
 /// Creates a log message event.
 /// </summary>
 /// <param name="client">The client instance.</param>
 /// <param name="source">The log source.</param>
 /// <param name="message">The log message.</param>
 public static EventBuilder CreateLog(this ExceptionlessClient client, string source, string message)
 {
     return(client.CreateLog(message).SetSource(source));
 }