private async Task PostMessageToThreadAsync( SlackClient slackClient, LogEvent logEvent, string replayTimespan, Dictionary <string, string> properties = null, string message = null) { var threadMessageBuilder = MessageBuilderExtensions .CreateMessageBuilder(_logOptions.Channel, logEvent, message, replayTimespan) .MessageBlock(message) .AttachmentProperties(logEvent, properties); if (logEvent.Exception != null) { await AttachExceptionAsync(slackClient, threadMessageBuilder, logEvent.Exception); } var slackMessage = threadMessageBuilder.CreateMessage(); await slackClient.Chat.PostMessageAsync(slackMessage); }
private Task <SendMessageResponse> PostMessageToSlackAsync( SlackClient slackClient, LogEvent logEvent, string message, Dictionary <string, string> properties = null) { var messageBuilder = MessageBuilderExtensions .CreateMessageBuilder(_logOptions.Channel, logEvent, message); if (_logOptions.Mentions != null && _logOptions.Mentions.TryGetValue(logEvent.Level, out var mention)) { messageBuilder.MentionBlock(mention); } var messageRequest = messageBuilder .AttachmentProperties(logEvent, properties, message) .CreateMessage(); return(slackClient.Chat.PostMessageAsync(messageRequest)); }