From 8e3eaed6225e413be0e441e24d62bff6a5459685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20K=C3=A1cha?= <ph@cesnet.cz> Date: Thu, 15 Jan 2015 17:34:09 +0100 Subject: [PATCH] Nonexistent/wrong id file now reported as "info", not "error" --- warden3/warden_client/warden_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/warden3/warden_client/warden_client.py b/warden3/warden_client/warden_client.py index 39e52ce..531e1c1 100644 --- a/warden3/warden_client/warden_client.py +++ b/warden3/warden_client/warden_client.py @@ -57,7 +57,7 @@ class Error(Exception): Also, it can be raised as an exception. """ - def __init__(self, message, logger=None, error=None, method=None, + def __init__(self, message, logger=None, error=None, prio="error", method=None, detail=None, exc=None): self.error = error @@ -67,7 +67,7 @@ class Error(Exception): (self.exctype, self.excval, self.exctb) = exc or exc_info() self.cause = self.excval # compatibility with other exceptions if logger: - logger.error(str(self)) + getattr(logger, prio, "error")(str(self)) logger.info(self.info_str()) logger.debug(self.debug_str()) @@ -334,7 +334,7 @@ class Client(object): f.write(str(id)) except (ValueError, IOError) as e: # Use Error instance just for proper logging - Error("Writing id file \"%s\" failed" % idf, self.logger, detail={"idstore": idf}) + Error("Writing id file \"%s\" failed" % idf, self.logger, prio="info", detail={"idstore": idf}) return id @@ -346,7 +346,7 @@ class Client(object): with open(idf, "r") as f: id = int(f.read()) except (ValueError, IOError) as e: - Error("Reading id file \"%s\" failed, relying on server" % idf, self.logger, detail={"idstore": idf}) + Error("Reading id file \"%s\" failed, relying on server" % idf, self.logger, prio="info", detail={"idstore": idf}) id = None return id -- GitLab