Metadata-Version: 2.0
Name: slack-logger
Version: 0.1.0
Summary: A Python logging handler for Slack integration
Home-page: https://github.com/junhwi/python-slack-logger
Author: Junhwi Kim
Author-email: junhwi.kim23@gmail.com
License: MIT
Keywords: slack logging
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: System :: Logging
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5

python-slack-logger
===================
.. image:: https://img.shields.io/pypi/pyversions/slack-logger.svg?maxAge=2592000?style=flat-square
    :target: https://pypi.python.org/pypi/slack-logger

Python logging handler for Slack web hook integration with simple configuration.

Installation
------------
.. code-block:: bash

    pip install slack-logger

Example
-------
Simple
''''''
.. code-block:: python

  import logging
  from slack_logger import SlackHandler, SlackFormatter

  sh = SlackHandler('YOUR_WEB_HOOK_URL') # url is like 'https://hooks.slack.com/...'
  sh.setFormatter(SlackFormatter())
  logging.basicConfig(handlers=[sh])
  logging.warning('warn message')

Using logger
''''''''''''
.. code-block:: python

  import logging
  from slack_logger import SlackHandler, SlackFormatter

  logger = logging.getLogger(__name__)
  logger.setLevel(logging.DEBUG)

  sh = SlackHandler(username='logger', icon_emoji=':robot_face:', url='YOUR_WEB_HOOK_URL')
  sh.setLevel(logging.DEBUG)

  f = SlackFormatter()
  sh.setFormatter(f)
  logger.addHandler(sh)

  logger.debug('debug message')
  logger.info('info message')
  logger.warn('warn message')
  logger.error('error message')
  logger.critical('critical message')


