Promote some logs from debug to info, and add punctuation.
This commit is contained in:
		
							parent
							
								
									d653317907
								
							
						
					
					
						commit
						8e3bcbc1af
					
				
					 2 changed files with 30 additions and 31 deletions
				
			
		|  | @ -111,7 +111,7 @@ class GroupableMixin(metaclass=abc.ABCMeta): | ||||||
|         if self.has_child(member): |         if self.has_child(member): | ||||||
|             return BAIL |             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(): |         for my_ancestor in self.walk_parents(): | ||||||
|             if my_ancestor == member: |             if my_ancestor == member: | ||||||
|  | @ -215,7 +215,7 @@ class GroupableMixin(metaclass=abc.ABCMeta): | ||||||
|         if not self.has_child(member): |         if not self.has_child(member): | ||||||
|             return BAIL |             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 = { |         pairs = { | ||||||
|             'parentid': self.id, |             'parentid': self.id, | ||||||
|  | @ -321,7 +321,7 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|         if self.has_associated_directory(path): |         if self.has_associated_directory(path): | ||||||
|             return |             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} |         data = {'albumid': self.id, 'directory': path.absolute_path} | ||||||
|         self.photodb.sql_insert(table='album_associated_directories', data=data) |         self.photodb.sql_insert(table='album_associated_directories', data=data) | ||||||
| 
 | 
 | ||||||
|  | @ -352,7 +352,7 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|         return super().add_children(*args, **kwargs) |         return super().add_children(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     def _add_photo(self, photo): |     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} |         data = {'albumid': self.id, 'photoid': photo.id} | ||||||
|         self.photodb.sql_insert(table='album_photo_rel', data=data) |         self.photodb.sql_insert(table='album_photo_rel', data=data) | ||||||
| 
 | 
 | ||||||
|  | @ -397,7 +397,7 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|     @decorators.required_feature('album.edit') |     @decorators.required_feature('album.edit') | ||||||
|     @decorators.transaction |     @decorators.transaction | ||||||
|     def delete(self, *, delete_children=False): |     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) |         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_associated_directories', pairs={'albumid': self.id}) | ||||||
|         self.photodb.sql_delete(table='album_photo_rel', 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) |         return super().remove_children(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     def _remove_photo(self, photo): |     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} |         pairs = {'albumid': self.id, 'photoid': photo.id} | ||||||
|         self.photodb.sql_delete(table='album_photo_rel', pairs=pairs) |         self.photodb.sql_delete(table='album_photo_rel', pairs=pairs) | ||||||
| 
 | 
 | ||||||
|  | @ -760,16 +760,16 @@ class Photo(ObjectBase): | ||||||
|         # keep our current one. |         # keep our current one. | ||||||
|         existing = self.has_tag(tag, check_children=True) |         existing = self.has_tag(tag, check_children=True) | ||||||
|         if existing: |         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 |             return existing | ||||||
| 
 | 
 | ||||||
|         # If the new tag is more specific, remove our current one for it. |         # If the new tag is more specific, remove our current one for it. | ||||||
|         for parent in tag.walk_parents(): |         for parent in tag.walk_parents(): | ||||||
|             if self.has_tag(parent, check_children=False): |             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.remove_tag(parent) | ||||||
| 
 | 
 | ||||||
|         self.photodb.log.debug('Applying %s to %s', tag, self) |         self.photodb.log.info('Applying %s to %s.', tag, self) | ||||||
| 
 | 
 | ||||||
|         data = { |         data = { | ||||||
|             'photoid': self.id, |             'photoid': self.id, | ||||||
|  | @ -816,7 +816,7 @@ class Photo(ObjectBase): | ||||||
|         ''' |         ''' | ||||||
|         Delete the Photo and its relation to any tags and albums. |         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='photo_tag_rel', pairs={'photoid': self.id}) | ||||||
|         self.photodb.sql_delete(table='album_photo_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}) |         self.photodb.sql_delete(table='photos', pairs={'id': self.id}) | ||||||
|  | @ -824,10 +824,10 @@ class Photo(ObjectBase): | ||||||
|         if delete_file: |         if delete_file: | ||||||
|             path = self.real_path.absolute_path |             path = self.real_path.absolute_path | ||||||
|             if self.photodb.config['recycle_instead_of_delete']: |             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 |                 action = send2trash.send2trash | ||||||
|             else: |             else: | ||||||
|                 self.photodb.log.debug('Deleting %s', path) |                 self.photodb.log.debug('Deleting %s.', path) | ||||||
|                 action = os.remove |                 action = os.remove | ||||||
| 
 | 
 | ||||||
|             self.photodb.on_commit_queue.append({ |             self.photodb.on_commit_queue.append({ | ||||||
|  | @ -861,7 +861,7 @@ class Photo(ObjectBase): | ||||||
|         return_filepath = None |         return_filepath = None | ||||||
| 
 | 
 | ||||||
|         if self.simple_mimetype == 'image': |         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: |             try: | ||||||
|                 image = helpers.generate_image_thumbnail( |                 image = helpers.generate_image_thumbnail( | ||||||
|                     self.real_path.absolute_path, |                     self.real_path.absolute_path, | ||||||
|  | @ -875,7 +875,7 @@ class Photo(ObjectBase): | ||||||
|                 return_filepath = hopeful_filepath |                 return_filepath = hopeful_filepath | ||||||
| 
 | 
 | ||||||
|         elif self.simple_mimetype == 'video' and constants.ffmpeg: |         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: |             try: | ||||||
|                 success = helpers.generate_video_thumbnail( |                 success = helpers.generate_video_thumbnail( | ||||||
|                     self.real_path.absolute_path, |                     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. |         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.bytes = None | ||||||
|         self.dev_ino = 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.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 = { |         data = { | ||||||
|             'id': self.id, |             'id': self.id, | ||||||
|             'filepath': new_filepath.absolute_path, |             'filepath': new_filepath.absolute_path, | ||||||
|  | @ -1104,7 +1104,7 @@ class Photo(ObjectBase): | ||||||
|     def remove_tag(self, tag): |     def remove_tag(self, tag): | ||||||
|         tag = self.photodb.get_tag(name=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} |         pairs = {'photoid': self.id, 'tagid': tag.id} | ||||||
|         self.photodb.sql_delete(table='photo_tag_rel', pairs=pairs) |         self.photodb.sql_delete(table='photo_tag_rel', pairs=pairs) | ||||||
| 
 | 
 | ||||||
|  | @ -1119,7 +1119,7 @@ class Photo(ObjectBase): | ||||||
|     def remove_tags(self, tags): |     def remove_tags(self, tags): | ||||||
|         tags = [self.photodb.get_tag(name=tag) for tag in 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''' |         query = f''' | ||||||
|         DELETE FROM photo_tag_rel |         DELETE FROM photo_tag_rel | ||||||
|         WHERE tagid IN {sqlhelpers.listify(tag.id for tag in tags)} |         WHERE tagid IN {sqlhelpers.listify(tag.id for tag in tags)} | ||||||
|  | @ -1159,7 +1159,7 @@ class Photo(ObjectBase): | ||||||
| 
 | 
 | ||||||
|         new_path.assert_not_exists() |         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) |         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.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() |         self.photodb.caches['tag_exports'].clear() | ||||||
| 
 | 
 | ||||||
|  | @ -1423,7 +1423,7 @@ class Tag(ObjectBase, GroupableMixin): | ||||||
|     @decorators.required_feature('tag.edit') |     @decorators.required_feature('tag.edit') | ||||||
|     @decorators.transaction |     @decorators.transaction | ||||||
|     def delete(self, *, delete_children=False): |     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) |         super().delete(delete_children=delete_children) | ||||||
|         self.photodb.sql_delete(table='photo_tag_rel', pairs={'tagid': self.id}) |         self.photodb.sql_delete(table='photo_tag_rel', pairs={'tagid': self.id}) | ||||||
|         self.photodb.sql_delete(table='tag_synonyms', pairs={'mastername': self.name}) |         self.photodb.sql_delete(table='tag_synonyms', pairs={'mastername': self.name}) | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ class PDBAlbumMixin: | ||||||
| 
 | 
 | ||||||
|         # Ok. |         # Ok. | ||||||
|         album_id = self.generate_id(table='albums') |         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 = { |         data = { | ||||||
|             'id': album_id, |             'id': album_id, | ||||||
|  | @ -115,7 +115,7 @@ class PDBAlbumMixin: | ||||||
|         directories = [directory.absolute_path for directory in directories if not directory.exists] |         directories = [directory.absolute_path for directory in directories if not directory.exists] | ||||||
|         if not directories: |         if not directories: | ||||||
|             return |             return | ||||||
|         self.log.debug('Purging associated directories %s', directories) |         self.log.info('Purging associated directories %s.', directories) | ||||||
|         directories = sqlhelpers.listify(directories) |         directories = sqlhelpers.listify(directories) | ||||||
| 
 | 
 | ||||||
|         query = f'DELETE FROM album_associated_directories WHERE directory in {directories}' |         query = f'DELETE FROM album_associated_directories WHERE directory in {directories}' | ||||||
|  | @ -174,7 +174,7 @@ class PDBBookmarkMixin: | ||||||
| 
 | 
 | ||||||
|         # Ok. |         # Ok. | ||||||
|         bookmark_id = self.generate_id(table='bookmarks') |         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 = { |         data = { | ||||||
|             'id': bookmark_id, |             'id': bookmark_id, | ||||||
|  | @ -485,7 +485,7 @@ class PDBPhotoMixin: | ||||||
| 
 | 
 | ||||||
|         # Ok. |         # Ok. | ||||||
|         photo_id = self.generate_id(table='photos') |         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 = { |         data = { | ||||||
|             'id': photo_id, |             'id': photo_id, | ||||||
|  | @ -1008,7 +1008,6 @@ class PDBSQLMixin: | ||||||
|             # method instead of allowing sql's release to commit. |             # method instead of allowing sql's release to commit. | ||||||
|             self.commit() |             self.commit() | ||||||
|         else: |         else: | ||||||
|             self.log.log(5, 'Releasing savepoint %s', savepoint) |  | ||||||
|             self.sql_execute(f'RELEASE "{savepoint}"') |             self.sql_execute(f'RELEASE "{savepoint}"') | ||||||
|             self.savepoints = helpers.slice_before(self.savepoints, savepoint) |             self.savepoints = helpers.slice_before(self.savepoints, savepoint) | ||||||
| 
 | 
 | ||||||
|  | @ -1040,7 +1039,7 @@ class PDBSQLMixin: | ||||||
|             task['action'](*args, **kwargs) |             task['action'](*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|         if savepoint is not None: |         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.sql_execute(f'ROLLBACK TO "{savepoint}"') | ||||||
|             self.savepoints = helpers.slice_before(self.savepoints, savepoint) |             self.savepoints = helpers.slice_before(self.savepoints, savepoint) | ||||||
|             self.on_commit_queue = helpers.slice_before(self.on_commit_queue, savepoint) |             self.on_commit_queue = helpers.slice_before(self.on_commit_queue, savepoint) | ||||||
|  | @ -1228,7 +1227,7 @@ class PDBTagMixin: | ||||||
| 
 | 
 | ||||||
|         # Ok. |         # Ok. | ||||||
|         tag_id = self.generate_id(table='tags') |         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() |         self.caches['tag_exports'].clear() | ||||||
| 
 | 
 | ||||||
|  | @ -1414,7 +1413,7 @@ class PDBUserMixin: | ||||||
| 
 | 
 | ||||||
|         # Ok. |         # Ok. | ||||||
|         user_id = self.generate_user_id() |         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()) |         hashed_password = bcrypt.hashpw(password, bcrypt.gensalt()) | ||||||
| 
 | 
 | ||||||
|  | @ -1617,7 +1616,7 @@ class PDBUtilMixin: | ||||||
| 
 | 
 | ||||||
|         albums_by_path = {} |         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( |         walk_generator = spinal.walk_generator( | ||||||
|             directory, |             directory, | ||||||
|             exclude_directories=exclude_directories, |             exclude_directories=exclude_directories, | ||||||
|  | @ -1817,7 +1816,7 @@ class PhotoDB( | ||||||
|             ) |             ) | ||||||
| 
 | 
 | ||||||
|     def _first_time_setup(self): |     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.executescript(constants.DB_INIT) | ||||||
|         self.sql.commit() |         self.sql.commit() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue