logging: use routes to separate logging configurations
This commit is contained in:
parent
e7bba205b8
commit
cb58430321
@ -99,7 +99,7 @@ if __name__ == '__main__':
|
|||||||
device_dir = conf.get('device_dir', '/srv/node')
|
device_dir = conf.get('device_dir', '/srv/node')
|
||||||
minutes = int(conf.get('minutes', 60))
|
minutes = int(conf.get('minutes', 60))
|
||||||
error_limit = int(conf.get('error_limit', 1))
|
error_limit = int(conf.get('error_limit', 1))
|
||||||
logger = get_logger(conf, 'drive-audit')
|
logger = get_logger(conf, log_route='drive-audit')
|
||||||
devices = get_devices(device_dir, logger)
|
devices = get_devices(device_dir, logger)
|
||||||
logger.debug("Devices found: %s" % str(devices))
|
logger.debug("Devices found: %s" % str(devices))
|
||||||
if not devices:
|
if not devices:
|
||||||
|
@ -34,7 +34,7 @@ if __name__ == '__main__':
|
|||||||
uploader_conf.update(plugin_conf)
|
uploader_conf.update(plugin_conf)
|
||||||
|
|
||||||
# pre-configure logger
|
# pre-configure logger
|
||||||
logger = utils.get_logger(uploader_conf, plugin,
|
logger = utils.get_logger(uploader_conf, plugin, log_route='log-uploader',
|
||||||
log_to_console=options.get('verbose', False))
|
log_to_console=options.get('verbose', False))
|
||||||
# currently LogUploader only supports run_once
|
# currently LogUploader only supports run_once
|
||||||
options['once'] = True
|
options['once'] = True
|
||||||
|
@ -28,7 +28,7 @@ class AccountAuditor(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf, 'account-auditor')
|
self.logger = get_logger(conf, log_route='account-auditor')
|
||||||
self.devices = conf.get('devices', '/srv/node')
|
self.devices = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -53,7 +53,7 @@ class AccountReaper(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='account-reaper')
|
||||||
self.devices = conf.get('devices', '/srv/node')
|
self.devices = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -42,7 +42,7 @@ class AccountController(object):
|
|||||||
"""WSGI controller for the account server."""
|
"""WSGI controller for the account server."""
|
||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='account-server')
|
||||||
self.root = conf.get('devices', '/srv/node')
|
self.root = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -90,7 +90,7 @@ class AuthController(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='auth-server')
|
||||||
self.super_admin_key = conf.get('super_admin_key')
|
self.super_admin_key = conf.get('super_admin_key')
|
||||||
if not self.super_admin_key:
|
if not self.super_admin_key:
|
||||||
msg = _('No super_admin_key set in conf file! Exiting.')
|
msg = _('No super_admin_key set in conf file! Exiting.')
|
||||||
|
@ -26,7 +26,7 @@ class Daemon(object):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = utils.get_logger(conf, 'swift-daemon')
|
self.logger = utils.get_logger(conf, log_route='daemon')
|
||||||
|
|
||||||
def run_once(self):
|
def run_once(self):
|
||||||
"""Override this to run the script once"""
|
"""Override this to run the script once"""
|
||||||
@ -84,7 +84,7 @@ def run_daemon(klass, conf_file, section_name='',
|
|||||||
logger = kwargs.pop('logger')
|
logger = kwargs.pop('logger')
|
||||||
else:
|
else:
|
||||||
logger = utils.get_logger(conf, conf.get('log_name', section_name),
|
logger = utils.get_logger(conf, conf.get('log_name', section_name),
|
||||||
log_to_console=kwargs.pop('verbose', False))
|
log_to_console=kwargs.pop('verbose', False), log_route=section_name)
|
||||||
try:
|
try:
|
||||||
klass(conf).run(once=once, **kwargs)
|
klass(conf).run(once=once, **kwargs)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -92,7 +92,7 @@ class Replicator(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='replicator')
|
||||||
self.root = conf.get('devices', '/srv/node')
|
self.root = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -30,7 +30,7 @@ class CatchErrorMiddleware(object):
|
|||||||
self.logger = getattr(app, 'logger', None)
|
self.logger = getattr(app, 'logger', None)
|
||||||
if not self.logger:
|
if not self.logger:
|
||||||
# and only call get_logger if we have to
|
# and only call get_logger if we have to
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='catch-errors')
|
||||||
|
|
||||||
def __call__(self, env, start_response):
|
def __call__(self, env, start_response):
|
||||||
try:
|
try:
|
||||||
|
@ -53,7 +53,7 @@ class CNAMELookupMiddleware(object):
|
|||||||
self.storage_domain = '.' + self.storage_domain
|
self.storage_domain = '.' + self.storage_domain
|
||||||
self.lookup_depth = int(conf.get('lookup_depth', '1'))
|
self.lookup_depth = int(conf.get('lookup_depth', '1'))
|
||||||
self.memcache = None
|
self.memcache = None
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='cname-lookup')
|
||||||
|
|
||||||
def __call__(self, env, start_response):
|
def __call__(self, env, start_response):
|
||||||
if not self.storage_domain:
|
if not self.storage_domain:
|
||||||
|
@ -39,7 +39,7 @@ class RateLimitMiddleware(object):
|
|||||||
if logger:
|
if logger:
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
else:
|
else:
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='ratelimit')
|
||||||
self.account_ratelimit = float(conf.get('account_ratelimit', 0))
|
self.account_ratelimit = float(conf.get('account_ratelimit', 0))
|
||||||
self.max_sleep_time_seconds = \
|
self.max_sleep_time_seconds = \
|
||||||
float(conf.get('max_sleep_time_seconds', 60))
|
float(conf.get('max_sleep_time_seconds', 60))
|
||||||
|
@ -51,7 +51,7 @@ class Swauth(object):
|
|||||||
def __init__(self, app, conf):
|
def __init__(self, app, conf):
|
||||||
self.app = app
|
self.app = app
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='swauth')
|
||||||
self.log_headers = conf.get('log_headers') == 'True'
|
self.log_headers = conf.get('log_headers') == 'True'
|
||||||
self.reseller_prefix = conf.get('reseller_prefix', 'AUTH').strip()
|
self.reseller_prefix = conf.get('reseller_prefix', 'AUTH').strip()
|
||||||
if self.reseller_prefix and self.reseller_prefix[-1] != '_':
|
if self.reseller_prefix and self.reseller_prefix[-1] != '_':
|
||||||
|
@ -395,6 +395,8 @@ def get_logger(conf, name=None, log_to_console=False, log_route=None):
|
|||||||
:param conf: Configuration dict to read settings from
|
:param conf: Configuration dict to read settings from
|
||||||
:param name: Name of the logger
|
:param name: Name of the logger
|
||||||
:param log_to_console: Add handler which writes to console on stderr
|
:param log_to_console: Add handler which writes to console on stderr
|
||||||
|
:param log_route: Route for the logging, not emitted to the log, just used
|
||||||
|
to separate logging configurations
|
||||||
"""
|
"""
|
||||||
if not conf:
|
if not conf:
|
||||||
conf = {}
|
conf = {}
|
||||||
|
@ -113,7 +113,7 @@ def run_wsgi(conf_file, app_section, *args, **kwargs):
|
|||||||
logger = kwargs.pop('logger')
|
logger = kwargs.pop('logger')
|
||||||
else:
|
else:
|
||||||
logger = get_logger(conf, log_name,
|
logger = get_logger(conf, log_name,
|
||||||
log_to_console=kwargs.pop('verbose', False))
|
log_to_console=kwargs.pop('verbose', False), log_route='wsgi')
|
||||||
|
|
||||||
# redirect errors to logger and close stdio
|
# redirect errors to logger and close stdio
|
||||||
capture_stdio(logger)
|
capture_stdio(logger)
|
||||||
|
@ -28,7 +28,7 @@ class ContainerAuditor(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf, 'container-auditor')
|
self.logger = get_logger(conf, log_route='container-auditor')
|
||||||
self.devices = conf.get('devices', '/srv/node')
|
self.devices = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -49,7 +49,7 @@ class ContainerController(object):
|
|||||||
save_headers = ['x-container-read', 'x-container-write']
|
save_headers = ['x-container-read', 'x-container-write']
|
||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='container-server')
|
||||||
self.root = conf.get('devices', '/srv/node/')
|
self.root = conf.get('devices', '/srv/node/')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -37,7 +37,7 @@ class ContainerUpdater(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf, 'container-updater')
|
self.logger = get_logger(conf, log_route='container-updater')
|
||||||
self.devices = conf.get('devices', '/srv/node')
|
self.devices = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -31,7 +31,7 @@ class ObjectAuditor(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf, 'object-auditor')
|
self.logger = get_logger(conf, log_route='object-auditor')
|
||||||
self.devices = conf.get('devices', '/srv/node')
|
self.devices = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -207,7 +207,7 @@ class ObjectReplicator(Daemon):
|
|||||||
:param logger: logging object
|
:param logger: logging object
|
||||||
"""
|
"""
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf, 'object-replicator')
|
self.logger = get_logger(conf, log_route='object-replicator')
|
||||||
self.devices_dir = conf.get('devices', '/srv/node')
|
self.devices_dir = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -266,7 +266,7 @@ class ObjectController(object):
|
|||||||
<source-dir>/etc/object-server.conf-sample or
|
<source-dir>/etc/object-server.conf-sample or
|
||||||
/etc/swift/object-server.conf-sample.
|
/etc/swift/object-server.conf-sample.
|
||||||
"""
|
"""
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='object-server')
|
||||||
self.devices = conf.get('devices', '/srv/node/')
|
self.devices = conf.get('devices', '/srv/node/')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -35,7 +35,7 @@ class ObjectUpdater(Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = get_logger(conf, 'object-updater')
|
self.logger = get_logger(conf, log_route='object-updater')
|
||||||
self.devices = conf.get('devices', '/srv/node')
|
self.devices = conf.get('devices', '/srv/node')
|
||||||
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
self.mount_check = conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
|
@ -1607,7 +1607,7 @@ class BaseApplication(object):
|
|||||||
def __init__(self, conf, memcache=None, logger=None, account_ring=None,
|
def __init__(self, conf, memcache=None, logger=None, account_ring=None,
|
||||||
container_ring=None, object_ring=None):
|
container_ring=None, object_ring=None):
|
||||||
if logger is None:
|
if logger is None:
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='proxy-server')
|
||||||
else:
|
else:
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
if conf is None:
|
if conf is None:
|
||||||
|
@ -34,7 +34,7 @@ class AccessLogProcessor(object):
|
|||||||
conf.get('service_ips', '').split(',')\
|
conf.get('service_ips', '').split(',')\
|
||||||
if x.strip()]
|
if x.strip()]
|
||||||
self.warn_percent = float(conf.get('warn_percent', '0.8'))
|
self.warn_percent = float(conf.get('warn_percent', '0.8'))
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='access-processor')
|
||||||
|
|
||||||
def log_line_parser(self, raw_log):
|
def log_line_parser(self, raw_log):
|
||||||
'''given a raw access log line, return a dict of the good parts'''
|
'''given a raw access log line, return a dict of the good parts'''
|
||||||
|
@ -48,7 +48,8 @@ class AccountStat(Daemon):
|
|||||||
self.devices = server_conf.get('devices', '/srv/node')
|
self.devices = server_conf.get('devices', '/srv/node')
|
||||||
self.mount_check = server_conf.get('mount_check', 'true').lower() in \
|
self.mount_check = server_conf.get('mount_check', 'true').lower() in \
|
||||||
('true', 't', '1', 'on', 'yes', 'y')
|
('true', 't', '1', 'on', 'yes', 'y')
|
||||||
self.logger = get_logger(stats_conf, 'swift-account-stats-logger')
|
self.logger = \
|
||||||
|
get_logger(stats_conf, log_route='account-stats')
|
||||||
|
|
||||||
def run_once(self):
|
def run_once(self):
|
||||||
self.logger.info(_("Gathering account stats"))
|
self.logger.info(_("Gathering account stats"))
|
||||||
|
@ -40,7 +40,7 @@ class LogProcessor(object):
|
|||||||
|
|
||||||
def __init__(self, conf, logger):
|
def __init__(self, conf, logger):
|
||||||
if isinstance(logger, tuple):
|
if isinstance(logger, tuple):
|
||||||
self.logger = get_logger(*logger)
|
self.logger = get_logger(*logger, log_route='log-processor')
|
||||||
else:
|
else:
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ class LogProcessorDaemon(Daemon):
|
|||||||
c = conf.get('log-processor')
|
c = conf.get('log-processor')
|
||||||
super(LogProcessorDaemon, self).__init__(c)
|
super(LogProcessorDaemon, self).__init__(c)
|
||||||
self.total_conf = conf
|
self.total_conf = conf
|
||||||
self.logger = get_logger(c)
|
self.logger = get_logger(c, log_route='log-processor')
|
||||||
self.log_processor = LogProcessor(conf, self.logger)
|
self.log_processor = LogProcessor(conf, self.logger)
|
||||||
self.lookback_hours = int(c.get('lookback_hours', '120'))
|
self.lookback_hours = int(c.get('lookback_hours', '120'))
|
||||||
self.lookback_window = int(c.get('lookback_window',
|
self.lookback_window = int(c.get('lookback_window',
|
||||||
|
@ -65,7 +65,8 @@ class LogUploader(Daemon):
|
|||||||
self.filename_format = source_filename_format
|
self.filename_format = source_filename_format
|
||||||
self.internal_proxy = InternalProxy(proxy_server_conf)
|
self.internal_proxy = InternalProxy(proxy_server_conf)
|
||||||
log_name = 'swift-log-uploader-%s' % plugin_name
|
log_name = 'swift-log-uploader-%s' % plugin_name
|
||||||
self.logger = utils.get_logger(uploader_conf, plugin_name)
|
self.logger = \
|
||||||
|
utils.get_logger(uploader_conf, plugin_name, log_route=plugin_name)
|
||||||
|
|
||||||
def run_once(self):
|
def run_once(self):
|
||||||
self.logger.info(_("Uploading logs"))
|
self.logger.info(_("Uploading logs"))
|
||||||
|
@ -20,7 +20,7 @@ class StatsLogProcessor(object):
|
|||||||
"""Transform account storage stat logs"""
|
"""Transform account storage stat logs"""
|
||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.logger = get_logger(conf)
|
self.logger = get_logger(conf, log_route='stats-processor')
|
||||||
|
|
||||||
def process(self, obj_stream, data_object_account, data_object_container,
|
def process(self, obj_stream, data_object_account, data_object_container,
|
||||||
data_object_name):
|
data_object_name):
|
||||||
|
@ -456,7 +456,7 @@ class TestAuthServer(unittest.TestCase):
|
|||||||
def test_basic_logging(self):
|
def test_basic_logging(self):
|
||||||
log = StringIO()
|
log = StringIO()
|
||||||
log_handler = StreamHandler(log)
|
log_handler = StreamHandler(log)
|
||||||
logger = get_logger(self.conf, 'auth')
|
logger = get_logger(self.conf, 'auth-server', log_route='auth-server')
|
||||||
logger.logger.addHandler(log_handler)
|
logger.logger.addHandler(log_handler)
|
||||||
try:
|
try:
|
||||||
auth_server.http_connect = fake_http_connect(201)
|
auth_server.http_connect = fake_http_connect(201)
|
||||||
@ -534,7 +534,7 @@ class TestAuthServer(unittest.TestCase):
|
|||||||
orig_Request = auth_server.Request
|
orig_Request = auth_server.Request
|
||||||
log = StringIO()
|
log = StringIO()
|
||||||
log_handler = StreamHandler(log)
|
log_handler = StreamHandler(log)
|
||||||
logger = get_logger(self.conf, 'auth')
|
logger = get_logger(self.conf, 'auth-server', log_route='auth-server')
|
||||||
logger.logger.addHandler(log_handler)
|
logger.logger.addHandler(log_handler)
|
||||||
try:
|
try:
|
||||||
auth_server.Request = request_causing_exception
|
auth_server.Request = request_causing_exception
|
||||||
|
@ -28,7 +28,7 @@ class MyDaemon(daemon.Daemon):
|
|||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.logger = utils.get_logger(None, 'server')
|
self.logger = utils.get_logger(None, 'server', log_route='server')
|
||||||
MyDaemon.forever_called = False
|
MyDaemon.forever_called = False
|
||||||
MyDaemon.once_called = False
|
MyDaemon.once_called = False
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ user = %s
|
|||||||
sio = StringIO()
|
sio = StringIO()
|
||||||
logger = logging.getLogger('server')
|
logger = logging.getLogger('server')
|
||||||
logger.addHandler(logging.StreamHandler(sio))
|
logger.addHandler(logging.StreamHandler(sio))
|
||||||
logger = utils.get_logger(None, 'server')
|
logger = utils.get_logger(None, 'server', log_route='server')
|
||||||
daemon.run_daemon(MyDaemon, conf_file, logger=logger)
|
daemon.run_daemon(MyDaemon, conf_file, logger=logger)
|
||||||
self.assert_('user quit' in sio.getvalue().lower())
|
self.assert_('user quit' in sio.getvalue().lower())
|
||||||
|
|
||||||
|
@ -289,17 +289,19 @@ Error: unable to locate %s
|
|||||||
sio = StringIO()
|
sio = StringIO()
|
||||||
logger = logging.getLogger('server')
|
logger = logging.getLogger('server')
|
||||||
logger.addHandler(logging.StreamHandler(sio))
|
logger.addHandler(logging.StreamHandler(sio))
|
||||||
logger = utils.get_logger(None, 'server')
|
logger = utils.get_logger(None, 'server', log_route='server')
|
||||||
logger.warn('test1')
|
logger.warn('test1')
|
||||||
self.assertEquals(sio.getvalue(), 'test1\n')
|
self.assertEquals(sio.getvalue(), 'test1\n')
|
||||||
logger.debug('test2')
|
logger.debug('test2')
|
||||||
self.assertEquals(sio.getvalue(), 'test1\n')
|
self.assertEquals(sio.getvalue(), 'test1\n')
|
||||||
logger = utils.get_logger({'log_level': 'DEBUG'}, 'server')
|
logger = utils.get_logger({'log_level': 'DEBUG'}, 'server',
|
||||||
|
log_route='server')
|
||||||
logger.debug('test3')
|
logger.debug('test3')
|
||||||
self.assertEquals(sio.getvalue(), 'test1\ntest3\n')
|
self.assertEquals(sio.getvalue(), 'test1\ntest3\n')
|
||||||
# Doesn't really test that the log facility is truly being used all the
|
# Doesn't really test that the log facility is truly being used all the
|
||||||
# way to syslog; but exercises the code.
|
# way to syslog; but exercises the code.
|
||||||
logger = utils.get_logger({'log_facility': 'LOG_LOCAL3'}, 'server')
|
logger = utils.get_logger({'log_facility': 'LOG_LOCAL3'}, 'server',
|
||||||
|
log_route='server')
|
||||||
logger.warn('test4')
|
logger.warn('test4')
|
||||||
self.assertEquals(sio.getvalue(),
|
self.assertEquals(sio.getvalue(),
|
||||||
'test1\ntest3\ntest4\n')
|
'test1\ntest3\ntest4\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user