问题
I'm trying to use slack attachments to log application errors but the large fields like the stack trace are behaving weirdly.
First, when using attachments the table seems to be fixed to some arbitrary width, is there anyway to change this so a wider value can be allowed? Otherwise 50+% of the slack window is blank, a complete waste.
Using just text works fine, but there are a number of other smaller fields included that benefit from the field format.
Also I'm having a problem with slack doing strange wrapping when the message is large. Below is just a small snippet with a few characters falling off, but on the full stack there can be substantial loss.
Example (slack message builder)
Adding a single character to the string and now it starts chopping things off (the text is all there and selectable, it's just doing a terrible job at wrapping.)
Example 2
Anyone have any suggestions to get something even slightly more useful?
回答1:
I would suggest to upload the application errors as text file (Plain Text Snippet) instead putting the info into a message. That way you can post more data and the formatting is also better suited for this kind of data.
You can auto-share your uploaded file in a channel and it will appear as new message. You can also add comments to is if you want to convey more information.
Use the files.upload method to upload your error text as file with the filetype
set to text
to get a text snippet.
Here is an example how it looks like on Slack, when an app posts a new text snippet as described:
来源:https://stackoverflow.com/questions/38595363/slack-attachment-width-and-wrapping-issues