From 0cd16cf03d400002f1b96d20e269db8c0bf55dd3 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Thu, 2 Feb 2012 09:29:03 -0800 Subject: [PATCH] ceph: always add logger for daemons The extra log function added redundant info and didn't allow different levels. --- teuthology/task/ceph.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index b1156e4a1cd2b..e11d08bf2f469 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -24,34 +24,30 @@ class DaemonState(object): self.command_kwargs = command_kwargs self.role = role self.id_ = id_ - self.logger = command_kwargs.get("logger", None) + self.log = command_kwargs.get('logger', log) self.proc = None - def log(self, msg): - if self.logger is not None: - self.logger.info("%s.%s: %s"%(self.role, self.id_, msg)) - def stop(self): """ Note: this can raise a run.CommandFailedError, run.CommandCrashedError, or run.ConnectionLostError. """ if not self.running(): - self.log('tried to stop a non-running daemon') + self.log.error('tried to stop a non-running daemon') return self.proc.stdin.close() - self.log('waiting for process to exit') + self.log.debug('waiting for process to exit') run.wait([self.proc]) self.proc = None - self.log("Stopped") + self.log.info('Stopped') def restart(self): - self.log("Restarting") + self.log.info('Restarting') if self.proc is not None: - self.log("stopping old one...") + self.log.debug('stopping old one...') self.stop() self.proc = self.remote.run(*self.command_args, **self.command_kwargs) - self.log("Started") + self.log.info('Started') def running(self): return self.proc is not None -- 2.39.5