Metadata-Version: 2.1
Name: slack-webclient-logger
Version: 1.0.0
Summary: Python logging handler which post to slack
Home-page: https://github.com/NMRbox/slacklogger
Author: Gerard Weatherby
Author-email: gweatherby@uchc.edu
License: UNKNOWN
Keywords: slack logger
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: slackclient (>=2.50)

# Slack logger
This package provides a logging.Handler that will send message to a slack channel.
Supports updated _slack.WebClient_ API released in 2019. 

## Authorization
See https:://api.slack.com to for information on setting up app and get an authorization token. 
Only a "bot" token is required to use SlackHandler, however, the unittest is more comlete with a "user" token.

## Limitations
How often messages can be sent is limited by slack. See https://api.slack.com/docs/rate-limits. By
default, this handler only sends accumulated messages every 60 seconds. That can be adjusted by
the optional _update_ argument to __SlackHandler__.

### Example
```
token = 'your token here'
channel = 'your channel name'
handler = SlackHandler(token, channel)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
example_logger = logging.getLogger("Test Logger")
example_logger.propagate = False
example_logger.addHandler(handler)
example_logger.setLevel(logging.INFO)
example_logger.info("Then shalt thou use Python three, no more, no less.")
...
# at end of program
handler.send_remaining()
```

### Funding acknowledgment 
This work supported by National Institutes of Health (NIH) / National Institute of General Medical Sciences (NIGMS), grant 1P41GM111135.


