Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to preformat messages by wrapping it with triple backquotes #87

Open
aeroastro opened this issue May 22, 2019 · 0 comments
Open

Comments

@aeroastro
Copy link

Summary

Since log messages often contains special characters in markdown, I would like to forward messages in code blocks.

some error messages lib/foo.rb:100:in `initialize'

(NOTE: This is an example for GitHub flavored markdown, and we need to use different format for Slack.)

Background

I am using Slack now, and this Plugin is really useful to forward messages. I am mainly using the plugin to send some error messages to Slack.

The problem here is that since the message often contains special characters, we often see some malformated messages.

Current Message Example

Following are the sample messages sent to Slack (Ruby error message with backtrace and URL path). Although this is formatted with GitHub flavored markdown, it still shows the underlying problems on Slack notification.

ERROR -- : Faraday::ConnectionFailed (execution expired) at lib/foo.rb:100:in initialize' <<< lib/bar.rb:7:in initialize', path: /path/to/api?matcher1=&matcher2=hoge&matcher3=

Here, we can see the following problems, and I believe this is pretty common when handling log messages.

  • line numbers is converted into emoji 💯
  • backquotes indicating method make mispaired inline code
  • asterisks in path make partial text italic

Proposed Solution

I just would like to make the message preformatted with ``` like the GitHub app for Slack.

image

This can be achieved by improving the following line and adding some options.

return String.format("%s*%s in Graylog stream %s*:\n> %s", audience, messageLink, titleLink, msg.getMessage());

@aeroastro aeroastro changed the title Option to preformat messages by wrapping it with triple backquotes ` Option to preformat messages by wrapping it with triple backquotes May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant