Commit d41e9392 authored by Martin Matějek's avatar Martin Matějek

Fix logger string formating

parent bfd64e1c
......@@ -56,8 +56,8 @@ class Api:
Prefered method for creating notification with minimal knowledge of underlying layers
"""
# get pre-filled skeleton of class Notification
logger.debug("Create new notification: chosen skeleton: %s" % skel_id)
logger.debug("Create new notification: user opts entered: %s" % user_opts)
logger.debug("Create new notification: chosen skeleton: %s", skel_id)
logger.debug("Create new notification: user opts entered: %s", user_opts)
skel = self.plugins.get_skeleton(skel_id)
notif = Notification.new(skel, **user_opts)
......@@ -66,7 +66,7 @@ class Api:
self.notifications.store(notif)
# logger.debug("Stored notifications: %s" % self.notifications.get_all())
# logger.debug("Stored notifications: %s", self.notifications.get_all())
# TODO: rethink/refactor
def call_action(self, mgsid, name, **kwargs):
......
......@@ -52,7 +52,7 @@ class Notification:
# TODO: exception handling
except Exception as e:
# TODO: proper logging per exception
logger.warn("Failed to deserialize json file: %s" % e)
logger.warn("Failed to deserialize json file: %s", e)
def valid(self, timestamp=None):
"""If notification is still valid"""
......
......@@ -45,11 +45,11 @@ class NotificationStorage:
def load(self, storage_dir):
"""Deserialize from FS"""
logger.debug("Deserializing notifications from '%s'" % storage_dir)
logger.debug("Deserializing notifications from '%s'", storage_dir)
for root, dir, files in os.walk(storage_dir):
for f in files:
filepath = os.path.join(storage_dir, f)
logger.debug("File %s" % filepath)
logger.debug("File %s", filepath)
n = Notification.from_file(filepath)
self.notifications[n.notif_id] = n
......@@ -84,7 +84,7 @@ class NotificationStorage:
for n in to_delete:
self.dismiss(n.notif_id)
logger.debug("Deleting notification '{}' due to timeout".format(n.notif_id))
logger.debug("Deleting notification '%s' due to timeout", n.notif_id)
def dismiss(self, msgid):
"""Dismiss specific notification"""
......
......@@ -16,9 +16,9 @@ class Plugin:
for t in templates:
self.templates[t['type']] = t
logger.debug("%s" % notifications)
logger.debug("%s", notifications)
for n in notifications:
logger.debug("concrete notif: %s" % n)
logger.debug("concrete notif: %s", n)
self.notification_types[n['name']] = n
@classmethod
......
......@@ -60,10 +60,10 @@ class PluginStorage:
self.skeletons[skel_id] = NotificationSkeleton(name, template, actions) # cache it
# else:
# logger.warn("No such notification type '%s' in plugin '%s'" % (skel_name, plugin_name))
# logger.warn("No such notification type '%s' in plugin '%s'", skel_name, plugin_name)
# return what?
# else:
# logger.warn("No such skeleton: '%s'" % skel_id)
# logger.warn("No such skeleton: '%s'", skel_id)
# return what?
return self.skeletons[skel_id]
......@@ -72,11 +72,11 @@ class PluginStorage:
ret = []
for name, plugin in self.plugins.items():
logger.debug("%s - %s" % (name, plugin))
logger.debug("%s - %s", name, plugin)
args = plugin.get_notification_types()
logger.debug("Plugin metadata: %s" % args)
logger.debug("Plugin metadata: %s", args)
type_names = ["{}.{}".format(name, type_name) for type_name in args.keys()]
ret.extend(type_names)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment