Posts log events to Slack via API
Project description
slacker_log_handler
===================
Python log handler that posts to a Slack channel.
Posts to the Slack API using https://github.com/os/slacker.
For a different implementation using webhooks instead of Slacker,
see https://github.com/claudetech/python-slack-log or read http://www.pythian.com/blog/logging-for-slackers/
Created with the intention of using for a Django project,
but some effort has been made to make it generic enough that any Python project could use it.
## Options
### api_key (required)
Generate a key at https://api.slack.com/
### channel (required)
Set which channel you want to post to, e.g. "#general".
### username
The username that will post to Slack. Defaults to "Python logger".
### icon_url
URL to an image to use as the icon for the logger user
### icon_emoji
emoji to use as the icon. Overrides icon_url.
If neither icon_url nor icon_emoji is set,
:heavy_exclamation_mark: will be used.
## Suggested Django configuration
* Add 'slacker_log_handler' to INSTALLED_APPS
* Set SLACK_API_KEY
### Sample Django logging configuration
Logging reference: https://docs.djangoproject.com/en/1.7/topics/logging/
Sends INFO and ERRORS to Slack, as well as errors to admin emails.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'slack-error': {
'level': 'ERROR',
'api_key': SLACK_API_KEY,
'class': 'slacker_log_handler.SlackerLogHandler',
'channel': '#general'
},
'slack-info': {
'level': 'INFO',
'api_key': SLACK_API_KEY,
'class': 'slacker_log_handler.SlackerLogHandler',
'propagate': True,
},
}
}
## License
Apache 2.0
Slacker is also under Apache 2.0.
https://api.slack.com/terms-of-service
===================
Python log handler that posts to a Slack channel.
Posts to the Slack API using https://github.com/os/slacker.
For a different implementation using webhooks instead of Slacker,
see https://github.com/claudetech/python-slack-log or read http://www.pythian.com/blog/logging-for-slackers/
Created with the intention of using for a Django project,
but some effort has been made to make it generic enough that any Python project could use it.
## Options
### api_key (required)
Generate a key at https://api.slack.com/
### channel (required)
Set which channel you want to post to, e.g. "#general".
### username
The username that will post to Slack. Defaults to "Python logger".
### icon_url
URL to an image to use as the icon for the logger user
### icon_emoji
emoji to use as the icon. Overrides icon_url.
If neither icon_url nor icon_emoji is set,
:heavy_exclamation_mark: will be used.
## Suggested Django configuration
* Add 'slacker_log_handler' to INSTALLED_APPS
* Set SLACK_API_KEY
### Sample Django logging configuration
Logging reference: https://docs.djangoproject.com/en/1.7/topics/logging/
Sends INFO and ERRORS to Slack, as well as errors to admin emails.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'slack-error': {
'level': 'ERROR',
'api_key': SLACK_API_KEY,
'class': 'slacker_log_handler.SlackerLogHandler',
'channel': '#general'
},
'slack-info': {
'level': 'INFO',
'api_key': SLACK_API_KEY,
'class': 'slacker_log_handler.SlackerLogHandler',
'propagate': True,
},
}
}
## License
Apache 2.0
Slacker is also under Apache 2.0.
https://api.slack.com/terms-of-service
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for slacker_log_handler-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d66f370dba12cc6cfed49eb78f8544d1787cc645c07ea68e8f316f7772d1efc |
|
MD5 | 96e7d7268fae12f01cc6f21649a5471f |
|
BLAKE2b-256 | ccab5bc93dc69bd8a0cc896356f81766aa604d11f927e880c7e0208043c220d3 |
Close
Hashes for slacker_log_handler-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af95e516ff58c9f25f47b87ed1e5497393cba2e72358d78b177f47605186bc7b |
|
MD5 | eeaed464ac62906803d0da8c1658c32f |
|
BLAKE2b-256 | 2f0a0b93617ce8c8d0dc677b2c3cb1ade9feea27d929c74b4149b2343193806e |