Make Slack message logging optional #25
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(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 todebug!, using thelogcrate. To access these logs from an app, see the notes aboutsetting up
env_logger:https://github.com/rust-lang-nursery/log
It would be possible to replace some of the other
println!statementsin the chatbot module with
debug!orinfo!, but I've left that up toyour choice. I didn't see any other
println!statements that seemedcritical during a quick grep through the code.