minor logging improvements
This commit is contained in:
		| @@ -29,6 +29,9 @@ async def run(): | |||||||
|     # create an instance of Inkycal |     # create an instance of Inkycal | ||||||
|     # If your settings.json file is not in /boot, use the full path: |     # If your settings.json file is not in /boot, use the full path: | ||||||
|     # inky = Inkycal('path/to/settings.json', render=True) |     # inky = Inkycal('path/to/settings.json', render=True) | ||||||
|  |  | ||||||
|  |     # when using experimental PiSugar support: | ||||||
|  |     # inky = Inkycal(render=True, use_pi_sugar=True) | ||||||
|     inky = Inkycal(render=True) |     inky = Inkycal(render=True) | ||||||
|     await inky.run()  # If there were no issues, you can run Inkycal nonstop |     await inky.run()  # If there were no issues, you can run Inkycal nonstop | ||||||
|  |  | ||||||
|   | |||||||
| @@ -319,7 +319,7 @@ class Inkycal: | |||||||
|                 self.counter = 0 |                 self.counter = 0 | ||||||
|             else: |             else: | ||||||
|                 self.counter += 1 |                 self.counter += 1 | ||||||
|                 logger.info("successful") |                 logger.info("All images generated successfully!") | ||||||
|             del errors |             del errors | ||||||
|  |  | ||||||
|             if self.battery_capacity < 20: |             if self.battery_capacity < 20: | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ class Inkyimage: | |||||||
|             logger.error("Invalid Image file provided", exc_info=True) |             logger.error("Invalid Image file provided", exc_info=True) | ||||||
|             raise Exception("Please check if the path points to an image file.") |             raise Exception("Please check if the path points to an image file.") | ||||||
|  |  | ||||||
|         logger.info(f"width: {image.width}, height: {image.height}") |         logger.debug(f"width: {image.width}, height: {image.height}") | ||||||
|  |  | ||||||
|         image.convert(mode="RGBA")  # convert to a more suitable format |         image.convert(mode="RGBA")  # convert to a more suitable format | ||||||
|         self.image = image |         self.image = image | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ class Agenda(inkycal_module): | |||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|  |  | ||||||
|         logger.info(f'Image size: {im_size}') |         logger.debug(f'Image size: {im_size}') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ class Feeds(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'Image size: {im_size}') |         logger.debug(f'Image size: {im_size}') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -83,8 +83,9 @@ class Feeds(inkycal_module): | |||||||
|  |  | ||||||
|         # Check if internet is available |         # Check if internet is available | ||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.debug('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise NetworkNotReachableError |             raise NetworkNotReachableError | ||||||
|  |  | ||||||
|         # Set some parameters for formatting feeds |         # Set some parameters for formatting feeds | ||||||
|   | |||||||
| @@ -71,7 +71,7 @@ class Inkyimage(inkycal_module): | |||||||
|         # Remove background if present |         # Remove background if present | ||||||
|         im.remove_alpha() |         im.remove_alpha() | ||||||
|  |  | ||||||
|         # if autoflip was enabled, flip the image |         # if auto-flip was enabled, flip the image | ||||||
|         if self.autoflip: |         if self.autoflip: | ||||||
|             im.autoflip(self.orientation) |             im.autoflip(self.orientation) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ class Jokes(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'image size: {im_width} x {im_height} px') |         logger.debug(f'image size: {im_width} x {im_height} px') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -47,8 +47,9 @@ class Jokes(inkycal_module): | |||||||
|  |  | ||||||
|         # Check if internet is available |         # Check if internet is available | ||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.debug('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise NetworkNotReachableError |             raise NetworkNotReachableError | ||||||
|  |  | ||||||
|         # Set some parameters for formatting feeds |         # Set some parameters for formatting feeds | ||||||
|   | |||||||
| @@ -87,7 +87,7 @@ class Slideshow(inkycal_module): | |||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|  |  | ||||||
|         logger.info(f'Image size: {im_size}') |         logger.debug(f'Image size: {im_size}') | ||||||
|  |  | ||||||
|         # rotates list items by 1 index |         # rotates list items by 1 index | ||||||
|         def rotate(list: list): |         def rotate(list: list): | ||||||
|   | |||||||
| @@ -63,7 +63,7 @@ class Stocks(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'image size: {im_width} x {im_height} px') |         logger.debug(f'image size: {im_width} x {im_height} px') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels (required) |         # Create an image for black pixels and one for coloured pixels (required) | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
|   | |||||||
| @@ -45,7 +45,7 @@ class TextToDisplay(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'Image size: {im_size}') |         logger.debug(f'Image size: {im_size}') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class Tindie(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'image size: {im_width} x {im_height} px') |         logger.debug(f'image size: {im_width} x {im_height} px') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -50,6 +50,7 @@ class Tindie(inkycal_module): | |||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.info('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise NetworkNotReachableError |             raise NetworkNotReachableError | ||||||
|  |  | ||||||
|         # Set some parameters for formatting feeds |         # Set some parameters for formatting feeds | ||||||
|   | |||||||
| @@ -70,7 +70,7 @@ class Todoist(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'Image size: {im_size}') |         logger.debug(f'Image size: {im_size}') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -80,6 +80,7 @@ class Todoist(inkycal_module): | |||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.info('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise NetworkNotReachableError |             raise NetworkNotReachableError | ||||||
|  |  | ||||||
|         # Set some parameters for formatting todos |         # Set some parameters for formatting todos | ||||||
|   | |||||||
| @@ -154,7 +154,7 @@ class Weather(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info(f'Image size: {im_size}') |         logger.debug(f'Image size: {im_size}') | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels |         # Create an image for black pixels and one for coloured pixels | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -162,8 +162,9 @@ class Weather(inkycal_module): | |||||||
|  |  | ||||||
|         # Check if internet is available |         # Check if internet is available | ||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.debug('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise NetworkNotReachableError |             raise NetworkNotReachableError | ||||||
|  |  | ||||||
|         def get_moon_phase(): |         def get_moon_phase(): | ||||||
|   | |||||||
| @@ -90,7 +90,7 @@ class Webshot(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info('image size: {} x {} px'.format(im_width, im_height)) |         logger.debug('image size: {} x {} px'.format(im_width, im_height)) | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels (required) |         # Create an image for black pixels and one for coloured pixels (required) | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -100,6 +100,7 @@ class Webshot(inkycal_module): | |||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.info('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise Exception('Network could not be reached :/') |             raise Exception('Network could not be reached :/') | ||||||
|  |  | ||||||
|         logger.info( |         logger.info( | ||||||
|   | |||||||
| @@ -68,7 +68,7 @@ class Xkcd(inkycal_module): | |||||||
|         im_width = int(self.width - (2 * self.padding_left)) |         im_width = int(self.width - (2 * self.padding_left)) | ||||||
|         im_height = int(self.height - (2 * self.padding_top)) |         im_height = int(self.height - (2 * self.padding_top)) | ||||||
|         im_size = im_width, im_height |         im_size = im_width, im_height | ||||||
|         logger.info('image size: {} x {} px'.format(im_width, im_height)) |         logger.debug('image size: {} x {} px'.format(im_width, im_height)) | ||||||
|  |  | ||||||
|         # Create an image for black pixels and one for coloured pixels (required) |         # Create an image for black pixels and one for coloured pixels (required) | ||||||
|         im_black = Image.new('RGB', size=im_size, color='white') |         im_black = Image.new('RGB', size=im_size, color='white') | ||||||
| @@ -78,6 +78,7 @@ class Xkcd(inkycal_module): | |||||||
|         if internet_available(): |         if internet_available(): | ||||||
|             logger.info('Connection test passed') |             logger.info('Connection test passed') | ||||||
|         else: |         else: | ||||||
|  |             logger.error("Network not reachable. Please check your connection.") | ||||||
|             raise Exception('Network could not be reached :/') |             raise Exception('Network could not be reached :/') | ||||||
|  |  | ||||||
|         # Set some parameters for formatting feeds |         # Set some parameters for formatting feeds | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user