public static void LogWithTags(this ExceptionlessClient client, string logMessage, string[] tags, string source = null, LogLevels level = LogLevels.Info) { if (client.LoggingEnabled()) client.CreateLog(source, logMessage, level.Text()) .AddTags(tags) .Submit(); }
public static EventBuilder CreateFromLogEvent(this ExceptionlessClient client, LogEvent log) { var builder = log.Exception != null ? client.CreateException(log.Exception) : client.CreateLog(log.GetSource(), log.RenderMessage(), log.GetLevel()); builder.Target.Date = log.Timestamp; if (log.Level == LogEventLevel.Fatal) builder.MarkAsCritical(); if (!String.IsNullOrWhiteSpace(log.RenderMessage())) builder.SetMessage(log.RenderMessage()); return builder; }
public static EventBuilder CreateFromLogEvent(this ExceptionlessClient client, LoggingEvent ev) { var builder = ev.ExceptionObject != null ? client.CreateException(ev.ExceptionObject) : client.CreateLog(ev.LoggerName, ev.RenderedMessage, ev.Level.Name); builder.Target.Date = ev.TimeStamp; if (!String.IsNullOrWhiteSpace(ev.RenderedMessage)) builder.SetMessage(ev.RenderedMessage); if (ev.ExceptionObject != null) builder.SetSource(ev.LoggerName); var props = ev.GetProperties(); foreach (var key in props.GetKeys().Where(key => !_ignoredEventProperties.Contains(key, StringComparer.OrdinalIgnoreCase))) { string propName = key; if (propName.StartsWith("log4net:")) propName = propName.Substring(8); builder.SetProperty(propName, props[key]); } 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.AddObject(level.Trim(), Event.KnownDataKeys.Level); 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> 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(); }
/// <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); }
/// <summary> /// Submits a log message event. /// </summary> /// <param name="client">The client instance.</param> /// <param name="source">The log source.</param> /// <param name="level">The log level.</param> /// <param name="message">The log message.</param> public static void SubmitLog(this ExceptionlessClient client, string source, string message, LogLevel level) { client.CreateLog(source, 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> public static void SubmitLog(this ExceptionlessClient client, string source, string message) { client.CreateLog(source, message).Submit(); }