logging format

This commit is contained in:
j 2016-01-24 19:08:07 +05:30
parent 49fa35ae95
commit 26f2a40601
2 changed files with 11 additions and 13 deletions

View file

@ -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()

View file

@ -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,