SharpRaven.Data.SentryMessage.ToString C# (CSharp) Method

ToString() public method

Returns a System.String that represents this instance.
public ToString ( ) : string
return string
        public override string ToString()
        {
            if (this.message != null && this.parameters != null && this.parameters.Any())
            {
                try
                {
                    return String.Format(this.message, this.parameters);
                }
                catch
                {
                    return this.message;
                }
            }

            return this.message ?? String.Empty;
        }

Usage Example

コード例 #1
0
        /// <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);
        }
All Usage Examples Of SharpRaven.Data.SentryMessage::ToString