/// <summary> /// Creates a new instance of /// <see cref="JsonPacket" /> for the specified /// <paramref name="project" />. /// </summary> /// <param name="project">The project.</param> /// <param name="message">The message to capture.</param> /// <param name="level">The <see cref="ErrorLevel" /> of the captured <paramref name="message" />. Default <see cref="ErrorLevel.Info" />.</param> /// <param name="tags">The tags to annotate the captured <paramref name="message" /> with.</param> /// <param name="extra">The extra metadata to send with the captured <paramref name="message" />.</param> /// <returns> /// A new instance of <see cref="JsonPacket" /> for the specified <paramref name="project" />. /// </returns> public JsonPacket Create(string project, SentryMessage message, ErrorLevel level = ErrorLevel.Info, IDictionary<string, string> tags = null, object extra = null) { var json = new JsonPacket(project) { Message = message != null ? message.ToString() : null, MessageObject = message, Level = level, Tags = tags, Extra = extra }; return OnCreate(json); }
/// <summary> /// Creates a new instance of /// <see cref="JsonPacket" /> for the specified /// <paramref name="project" />. /// </summary> /// <param name="project">The project.</param> /// <param name="message">The message to capture.</param> /// <param name="level">The <see cref="ErrorLevel" /> of the captured <paramref name="message" />. Default <see cref="ErrorLevel.Info" />.</param> /// <param name="tags">The tags to annotate the captured <paramref name="message" /> with.</param> /// <param name="extra">The extra metadata to send with the captured <paramref name="message" />.</param> /// <returns> /// A new instance of <see cref="JsonPacket" /> for the specified <paramref name="project" />. /// </returns> public JsonPacket Create(string project, SentryMessage message, ErrorLevel level = ErrorLevel.Info, IDictionary <string, string> tags = null, object extra = null) { var json = new JsonPacket(project) { Message = message != null?message.ToString() : null, MessageObject = message, Level = level, Tags = tags, Extra = extra }; return(OnCreate(json)); }
/// <summary> /// Creates a new instance of /// <see cref="JsonPacket" /> for the specified /// <paramref name="project" />, with the /// given /// <paramref name="exception" />. /// </summary> /// <param name="project">The project.</param> /// <param name="exception">The <see cref="Exception" /> to capture.</param> /// <param name="message">The optional message to capture. Default: <see cref="Exception.Message" />.</param> /// <param name="level">The <see cref="ErrorLevel" /> of the captured <paramref name="exception" />. Default: <see cref="ErrorLevel.Error" />.</param> /// <param name="tags">The tags to annotate the captured <paramref name="exception" /> with.</param> /// <param name="fingerprint">The custom fingerprint to annotate the captured <paramref name="message" /> with.</param> /// <param name="extra">The extra metadata to send with the captured <paramref name="exception" />.</param> /// <returns> /// A new instance of /// <see cref="JsonPacket" /> for the specified /// <paramref name="project" />, with the /// given /// <paramref name="exception" />. /// </returns> public JsonPacket Create(string project, Exception exception, SentryMessage message = null, ErrorLevel level = ErrorLevel.Error, IDictionary <string, string> tags = null, string[] fingerprint = null, object extra = null) { var json = new JsonPacket(project, exception) { Message = message != null?message.ToString() : exception.Message, MessageObject = message, Level = level, Tags = tags, Fingerprint = fingerprint, Extra = Merge(extra, exception) }; return(OnCreate(json)); }
public void ToString_ReturnsMessage() { string stringMessage = Guid.NewGuid().ToString("N"); SentryMessage message = new SentryMessage(stringMessage); Assert.That(message.ToString(), Is.EqualTo(stringMessage)); }
public void ToString_ReturnsFormattedString() { Guid arg = Guid.NewGuid(); SentryMessage message = new SentryMessage("Format something {0:N} in here", arg); Assert.That(message.ToString(), Is.StringContaining(arg.ToString("N"))); }