diff --git a/etiquette/objects.py b/etiquette/objects.py index 0703caa..6b96bd7 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -111,7 +111,7 @@ class GroupableMixin(metaclass=abc.ABCMeta): if self.has_child(member): return BAIL - self.photodb.log.debug('Adding child %s to %s.', member, self) + self.photodb.log.info('Adding child %s to %s.', member, self) for my_ancestor in self.walk_parents(): if my_ancestor == member: @@ -215,7 +215,7 @@ class GroupableMixin(metaclass=abc.ABCMeta): if not self.has_child(member): return BAIL - self.photodb.log.debug('Removing child %s from %s.', member, self) + self.photodb.log.info('Removing child %s from %s.', member, self) pairs = { 'parentid': self.id, @@ -321,7 +321,7 @@ class Album(ObjectBase, GroupableMixin): if self.has_associated_directory(path): return - self.photodb.log.debug('Adding directory "%s" to %s.', path.absolute_path, self) + self.photodb.log.info('Adding directory "%s" to %s.', path.absolute_path, self) data = {'albumid': self.id, 'directory': path.absolute_path} self.photodb.sql_insert(table='album_associated_directories', data=data) @@ -352,7 +352,7 @@ class Album(ObjectBase, GroupableMixin): return super().add_children(*args, **kwargs) def _add_photo(self, photo): - self.photodb.log.debug('Adding photo %s to %s', photo, self) + self.photodb.log.info('Adding photo %s to %s.', photo, self) data = {'albumid': self.id, 'photoid': photo.id} self.photodb.sql_insert(table='album_photo_rel', data=data) @@ -397,7 +397,7 @@ class Album(ObjectBase, GroupableMixin): @decorators.required_feature('album.edit') @decorators.transaction def delete(self, *, delete_children=False): - self.photodb.log.debug('Deleting %s', self) + self.photodb.log.info('Deleting %s.', self) GroupableMixin.delete(self, delete_children=delete_children) self.photodb.sql_delete(table='album_associated_directories', pairs={'albumid': self.id}) self.photodb.sql_delete(table='album_photo_rel', pairs={'albumid': self.id}) @@ -522,7 +522,7 @@ class Album(ObjectBase, GroupableMixin): return super().remove_children(*args, **kwargs) def _remove_photo(self, photo): - self.photodb.log.debug('Removing photo %s from %s', photo, self) + self.photodb.log.info('Removing photo %s from %s.', photo, self) pairs = {'albumid': self.id, 'photoid': photo.id} self.photodb.sql_delete(table='album_photo_rel', pairs=pairs) @@ -760,16 +760,16 @@ class Photo(ObjectBase): # keep our current one. existing = self.has_tag(tag, check_children=True) if existing: - self.photodb.log.debug('Preferring existing %s over %s', existing, tag) + self.photodb.log.debug('Preferring existing %s over %s.', existing, tag) return existing # If the new tag is more specific, remove our current one for it. for parent in tag.walk_parents(): if self.has_tag(parent, check_children=False): - self.photodb.log.debug('Preferring new %s over %s', tag, parent) + self.photodb.log.debug('Preferring new %s over %s.', tag, parent) self.remove_tag(parent) - self.photodb.log.debug('Applying %s to %s', tag, self) + self.photodb.log.info('Applying %s to %s.', tag, self) data = { 'photoid': self.id, @@ -816,7 +816,7 @@ class Photo(ObjectBase): ''' Delete the Photo and its relation to any tags and albums. ''' - self.photodb.log.debug('Deleting %s', self) + self.photodb.log.info('Deleting %s.', self) self.photodb.sql_delete(table='photo_tag_rel', pairs={'photoid': self.id}) self.photodb.sql_delete(table='album_photo_rel', pairs={'photoid': self.id}) self.photodb.sql_delete(table='photos', pairs={'id': self.id}) @@ -824,10 +824,10 @@ class Photo(ObjectBase): if delete_file: path = self.real_path.absolute_path if self.photodb.config['recycle_instead_of_delete']: - self.photodb.log.debug('Recycling %s', path) + self.photodb.log.debug('Recycling %s.', path) action = send2trash.send2trash else: - self.photodb.log.debug('Deleting %s', path) + self.photodb.log.debug('Deleting %s.', path) action = os.remove self.photodb.on_commit_queue.append({ @@ -861,7 +861,7 @@ class Photo(ObjectBase): return_filepath = None if self.simple_mimetype == 'image': - self.photodb.log.debug('Thumbnailing %s', self.real_path.absolute_path) + self.photodb.log.info('Thumbnailing %s.', self.real_path.absolute_path) try: image = helpers.generate_image_thumbnail( self.real_path.absolute_path, @@ -875,7 +875,7 @@ class Photo(ObjectBase): return_filepath = hopeful_filepath elif self.simple_mimetype == 'video' and constants.ffmpeg: - self.photodb.log.debug('Thumbnailing %s', self.real_path.absolute_path) + self.photodb.log.info('Thumbnailing %s.', self.real_path.absolute_path) try: success = helpers.generate_video_thumbnail( self.real_path.absolute_path, @@ -1027,7 +1027,7 @@ class Photo(ObjectBase): ''' Load the file's height, width, etc as appropriate for this type of file. ''' - self.photodb.log.debug('Reloading metadata for %s', self) + self.photodb.log.info('Reloading metadata for %s.', self) self.bytes = None self.dev_ino = None @@ -1090,7 +1090,7 @@ class Photo(ObjectBase): self.photodb.assert_no_such_photo_by_path(filepath=new_filepath) - self.photodb.log.debug('Relocating %s to "%s"', self, new_filepath.absolute_path) + self.photodb.log.info('Relocating %s to "%s".', self, new_filepath.absolute_path) data = { 'id': self.id, 'filepath': new_filepath.absolute_path, @@ -1104,7 +1104,7 @@ class Photo(ObjectBase): def remove_tag(self, tag): tag = self.photodb.get_tag(name=tag) - self.photodb.log.debug('Removing %s from %s', tag, self) + self.photodb.log.info('Removing %s from %s.', tag, self) pairs = {'photoid': self.id, 'tagid': tag.id} self.photodb.sql_delete(table='photo_tag_rel', pairs=pairs) @@ -1119,7 +1119,7 @@ class Photo(ObjectBase): def remove_tags(self, tags): tags = [self.photodb.get_tag(name=tag) for tag in tags] - self.photodb.log.debug('Removing %s from %s', tags, self) + self.photodb.log.info('Removing %s from %s.', tags, self) query = f''' DELETE FROM photo_tag_rel WHERE tagid IN {sqlhelpers.listify(tag.id for tag in tags)} @@ -1159,7 +1159,7 @@ class Photo(ObjectBase): new_path.assert_not_exists() - self.photodb.log.debug('Renaming file "%s" -> "%s"', old_path.absolute_path, new_path.absolute_path) + self.photodb.log.info('Renaming file "%s" -> "%s".', old_path.absolute_path, new_path.absolute_path) new_path.parent.makedirs(exist_ok=True) @@ -1345,7 +1345,7 @@ class Tag(ObjectBase, GroupableMixin): self.photodb.assert_no_such_tag(name=synname) - self.photodb.log.debug('New synonym %s of %s', synname, self.name) + self.photodb.log.info('New synonym %s of %s.', synname, self.name) self.photodb.caches['tag_exports'].clear() @@ -1423,7 +1423,7 @@ class Tag(ObjectBase, GroupableMixin): @decorators.required_feature('tag.edit') @decorators.transaction def delete(self, *, delete_children=False): - self.photodb.log.debug('Deleting %s', self) + self.photodb.log.info('Deleting %s.', self) super().delete(delete_children=delete_children) self.photodb.sql_delete(table='photo_tag_rel', pairs={'tagid': self.id}) self.photodb.sql_delete(table='tag_synonyms', pairs={'mastername': self.name}) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index be051cb..019b68c 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -85,7 +85,7 @@ class PDBAlbumMixin: # Ok. album_id = self.generate_id(table='albums') - self.log.debug('New Album: %s %s', album_id, title) + self.log.info('New Album: %s %s.', album_id, title) data = { 'id': album_id, @@ -115,7 +115,7 @@ class PDBAlbumMixin: directories = [directory.absolute_path for directory in directories if not directory.exists] if not directories: return - self.log.debug('Purging associated directories %s', directories) + self.log.info('Purging associated directories %s.', directories) directories = sqlhelpers.listify(directories) query = f'DELETE FROM album_associated_directories WHERE directory in {directories}' @@ -174,7 +174,7 @@ class PDBBookmarkMixin: # Ok. bookmark_id = self.generate_id(table='bookmarks') - self.log.debug('New Bookmark: %s %s %s', bookmark_id, title, url) + self.log.info('New Bookmark: %s %s %s.', bookmark_id, title, url) data = { 'id': bookmark_id, @@ -485,7 +485,7 @@ class PDBPhotoMixin: # Ok. photo_id = self.generate_id(table='photos') - self.log.debug('New Photo: %s %s', photo_id, filepath.absolute_path) + self.log.info('New Photo: %s %s.', photo_id, filepath.absolute_path) data = { 'id': photo_id, @@ -1008,7 +1008,6 @@ class PDBSQLMixin: # method instead of allowing sql's release to commit. self.commit() else: - self.log.log(5, 'Releasing savepoint %s', savepoint) self.sql_execute(f'RELEASE "{savepoint}"') self.savepoints = helpers.slice_before(self.savepoints, savepoint) @@ -1040,7 +1039,7 @@ class PDBSQLMixin: task['action'](*args, **kwargs) if savepoint is not None: - self.log.debug('Rolling back to %s', savepoint) + self.log.debug('Rolling back to %s.', savepoint) self.sql_execute(f'ROLLBACK TO "{savepoint}"') self.savepoints = helpers.slice_before(self.savepoints, savepoint) self.on_commit_queue = helpers.slice_before(self.on_commit_queue, savepoint) @@ -1228,7 +1227,7 @@ class PDBTagMixin: # Ok. tag_id = self.generate_id(table='tags') - self.log.debug('New Tag: %s %s', tag_id, tagname) + self.log.info('New Tag: %s %s.', tag_id, tagname) self.caches['tag_exports'].clear() @@ -1414,7 +1413,7 @@ class PDBUserMixin: # Ok. user_id = self.generate_user_id() - self.log.debug('New User: %s %s', user_id, username) + self.log.info('New User: %s %s.', user_id, username) hashed_password = bcrypt.hashpw(password, bcrypt.gensalt()) @@ -1617,7 +1616,7 @@ class PDBUtilMixin: albums_by_path = {} - self.log.debug('Digesting directory "%s".', directory.absolute_path) + self.log.info('Digesting directory "%s".', directory.absolute_path) walk_generator = spinal.walk_generator( directory, exclude_directories=exclude_directories, @@ -1817,7 +1816,7 @@ class PhotoDB( ) def _first_time_setup(self): - self.log.debug('Running first-time database setup.') + self.log.info('Running first-time database setup.') self.sql.executescript(constants.DB_INIT) self.sql.commit()