chatbot icon indicating copy to clipboard operation
chatbot copied to clipboard

Make Slack message logging optional

Open emk opened this issue 9 years ago • 2 comments

(Thank you for incorporating my earlier changes! Here's one more patch based on some bot testing.)

By default, the Slack adapter logs all Slack messages (including those not acted on by handlers) to standard output. But when a chatbot's output is being forwarded to a central logging service like papertrail, this risks leaking or recording messages that should probably have remained in Slack. In fact, Slack has a whole set of message-retention tools that allow channel administrators to set policies:

https://slack.zendesk.com/hc/en-us/articles/203457187-Setting-up-custom-message-and-file-retention

Channel administrators with custom policies may object to bots which log messages elsewhere.

To fix this, I demote one println! statement to debug!, using the log crate. To access these logs from an app, see the notes about setting up env_logger:

https://github.com/rust-lang-nursery/log

It would be possible to replace some of the other println! statements in the chatbot module with debug! or info!, but I've left that up to your choice. I didn't see any other println! statements that seemed critical during a quick grep through the code.

emk avatar Nov 30 '15 18:11 emk

Oh shoot! Somehow missed this go by on my feed :flushed:. We should probably replace all of the println! statements with the log macros as you've suggested.

Looks like the test runner is messed up. I'll look into that. Do you want to update the rest of the println! statements, or should I just get this merged?

jwilm avatar Dec 05 '15 20:12 jwilm

Please feel free to go ahead and update and/or merge this!

I finally ran into enough issues keeping a Slack connection open that I converted our internal stuff to a stateless Slack command invoked via HTTP, using an Iron-based server.

emk avatar Sep 18 '16 11:09 emk