From 26f2a406017c55430e8a085d10747d47be1adf6e Mon Sep 17 00:00:00 2001 From: j Date: Sun, 24 Jan 2016 19:08:07 +0530 Subject: [PATCH] logging format --- oml/item/models.py | 10 ++++------ oml/item/scan.py | 14 +++++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/oml/item/models.py b/oml/item/models.py index 3477211..729839b 100644 --- a/oml/item/models.py +++ b/oml/item/models.py @@ -374,7 +374,7 @@ class Item(db.Model): break def update_cover(self): - logger.debug('update cover %s', self.id) + logger.debug('%s update cover', self.id) key = 'cover:%s'%self.id cover = None if 'cover' in self.meta and self.meta['cover']: @@ -394,9 +394,8 @@ class Item(db.Model): self.info['coverRatio'] = self.info['previewRatio'] elif 'coverRatio' in self.info: del self.info['coverRatio'] - logger.debug('clear cover:%s:', self.id) icons.clear('cover:%s:' % self.id) - logger.debug('update_cover done') + logger.debug('%s update_cover done', self.id) def get_preview(self): key = 'preview:%s'%self.id @@ -407,7 +406,7 @@ class Item(db.Model): icons[key] = preview def update_preview(self): - logger.debug('update_preview %s', self.id) + logger.debug('%s update_preview', self.id) key = 'preview:%s'%self.id preview = self.extract_preview() if preview: @@ -424,9 +423,8 @@ class Item(db.Model): self.info['previewRatio'] = self.info['coverRatio'] elif 'previewRatio' in self.info: del self.info['previewRatio'] - logger.debug('clear preview:%s:', self.id) icons.clear('preview:%s:' % self.id) - logger.debug('update_preview done %s', self.id) + logger.debug('%s update_preview done', self.id) def update_icons(self): self.update_cover() diff --git a/oml/item/scan.py b/oml/item/scan.py index 59ccb75..a8170db 100644 --- a/oml/item/scan.py +++ b/oml/item/scan.py @@ -52,23 +52,23 @@ def remove_missing(): def add_file(id, f, prefix, from_=None): user = state.user() path = f[len(prefix):] - logger.debug('extract metadata %s %s', id, path) + logger.debug('%s extract metadata %s', id, path) data = media.metadata(f, from_) - logger.debug('create file %s %s', id, path) + logger.debug('%s create file %s', id, path) file = File.get_or_create(id, data, path) item = file.item item.add_user(user) item.added = datetime.utcnow() - logger.debug('load metadata %s %s', id, path) + logger.debug('%s load metadata %s', id, path) item.load_metadata() Changelog.record(user, 'additem', item.id, file.info) Changelog.record(user, 'edititem', item.id, item.meta) - logger.debug('extract icons %s %s', id, path) + logger.debug('%s extract icons %s', id, path) item.update_icons() item.modified = datetime.utcnow() - logger.debug('save item %s', id) + logger.debug('%s save item', id) item.update() - logger.debug('added file %s', id) + logger.debug('%s added', id) return file def run_scan(): @@ -161,7 +161,7 @@ def run_import(options=None): logger.debug('active import canceled') state.activity = {} return - if count % 1000 == 0: + if count % 100 == 0: state.activity = { 'activity': 'import', 'path': prefix,