General cleanup and refactor of a lot of the API/WSGI service code.

This commit is contained in:
Brian Lamar
2011-06-18 23:10:41 -04:00
parent 0b6d7f4956
commit b7fe156f3d
2 changed files with 29 additions and 2 deletions

View File

@@ -314,3 +314,16 @@ logging.setLoggerClass(NovaLogger)
def audit(msg, *args, **kwargs):
"""Shortcut for logging to root log with sevrity 'AUDIT'."""
logging.root.log(AUDIT, msg, *args, **kwargs)
class WritableLogger(object):
"""A thin wrapper that responds to `write` and logs."""
def __init__(self, logger, level=logging.DEBUG):
self.logger = logger
self.level = level
def write(self, msg):
self.logger.log(self.level, msg)