Skip to content

Use the standard python logging, and have your logs on Hipchat!

License

Notifications You must be signed in to change notification settings

zulumarketing/hiplogging

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hiplogging

With Hiplogging, you can keep using the standard python logging module, and have the important log messages in HipChat, where they might actually reach you :)

Installation

Execute:

sudo python setup.py install

or, from pip

sudo pip install hiplogging

Example

Here’s how you use this. In bash:

export HIPCHAT_ADMIN_TOKEN=”ABCDEF”
export HIPCHAT_ROOM=’HelloWorld’

You can an admin token from this link.

Then, in the sweet code:

import os
import logging
import hiplogging

# Set up a standard logger
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()

# Add the hipchat handler
# Get an admin token from: https://<YOUR_HIPCHAT_NAME>.hipchat.com/admin/api
handler = hiplogging.HipChatHandler(os.environ['HIPCHAT_ADMIN_TOKEN'],
                                   os.environ['HIPCHAT_ROOM'])
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)

# Try it out: messages will be visible both in the console and on hipchat.
logger.debug('debug - we are approaching the anomaly')
logger.info('info - shields up, red alert!')
logger.warn('warn - shield down to 15%')
logger.fatal('fatal - what shields?')

This is what you get

This is what you get

About

Use the standard python logging, and have your logs on Hipchat!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%