Skip to content

Instantly share code, notes, and snippets.

@SupermanScott
Created January 22, 2012 19:46
Show Gist options
  • Save SupermanScott/1658436 to your computer and use it in GitHub Desktop.
Save SupermanScott/1658436 to your computer and use it in GitHub Desktop.
import redis
import logging
import redislog
import redislog.logger
logging.setLoggerClass(redislog.logger.RedisLogger)
LOGGING = {
'version': 1,
'formatters': {
'default': {
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
}
},
'handlers': {
'redis': {
'class': 'redislog.handlers.RedisHandler',
'channel' : 'hermey',
'redis_client': redis.Redis(host='localhost', port=6379),
'level': 'DEBUG',
},
'some.other.log': {
'class': 'logging.handlers.RotatingFileHandler',
'formatter': 'default',
'level': 'INFO',
'filename': '/var/log/other.log',
'backupCount': 5,
},
'loggers': {
'my.log': {
'handlers': ['some.other.log', 'redis'],
'level': 'DEBUG',
'format': 'default',
},
'exceptions': {
'handlers': ['redis'],
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment