minor logging improvements

This commit is contained in:
Ace 2024-06-25 14:22:38 +02:00
parent 427c55ef63
commit 762538d4da
15 changed files with 27 additions and 17 deletions

View File

@ -29,6 +29,9 @@ async def run():
# create an instance of Inkycal
# If your settings.json file is not in /boot, use the full path:
# 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)
await inky.run() # If there were no issues, you can run Inkycal nonstop

View File

@ -319,7 +319,7 @@ class Inkycal:
self.counter = 0
else:
self.counter += 1
logger.info("successful")
logger.info("All images generated successfully!")
del errors
if self.battery_capacity < 20:

View File

@ -59,7 +59,7 @@ class Inkyimage:
logger.error("Invalid Image file provided", exc_info=True)
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
self.image = image

View File

@ -86,7 +86,7 @@ class Agenda(inkycal_module):
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')

View File

@ -75,7 +75,7 @@ class Feeds(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')
@ -83,8 +83,9 @@ class Feeds(inkycal_module):
# Check if internet is available
if internet_available():
logger.info('Connection test passed')
logger.debug('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise NetworkNotReachableError
# Set some parameters for formatting feeds

View File

@ -71,7 +71,7 @@ class Inkyimage(inkycal_module):
# Remove background if present
im.remove_alpha()
# if autoflip was enabled, flip the image
# if auto-flip was enabled, flip the image
if self.autoflip:
im.autoflip(self.orientation)

View File

@ -39,7 +39,7 @@ class Jokes(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')
@ -47,8 +47,9 @@ class Jokes(inkycal_module):
# Check if internet is available
if internet_available():
logger.info('Connection test passed')
logger.debug('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise NetworkNotReachableError
# Set some parameters for formatting feeds

View File

@ -87,7 +87,7 @@ class Slideshow(inkycal_module):
im_height = int(self.height - (2 * self.padding_top))
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
def rotate(list: list):

View File

@ -63,7 +63,7 @@ class Stocks(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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)
im_black = Image.new('RGB', size=im_size, color='white')

View File

@ -45,7 +45,7 @@ class TextToDisplay(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')

View File

@ -40,7 +40,7 @@ class Tindie(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')
@ -50,6 +50,7 @@ class Tindie(inkycal_module):
if internet_available():
logger.info('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise NetworkNotReachableError
# Set some parameters for formatting feeds

View File

@ -70,7 +70,7 @@ class Todoist(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')
@ -80,6 +80,7 @@ class Todoist(inkycal_module):
if internet_available():
logger.info('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise NetworkNotReachableError
# Set some parameters for formatting todos

View File

@ -154,7 +154,7 @@ class Weather(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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
im_black = Image.new('RGB', size=im_size, color='white')
@ -162,8 +162,9 @@ class Weather(inkycal_module):
# Check if internet is available
if internet_available():
logger.info('Connection test passed')
logger.debug('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise NetworkNotReachableError
def get_moon_phase():

View File

@ -90,7 +90,7 @@ class Webshot(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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)
im_black = Image.new('RGB', size=im_size, color='white')
@ -100,6 +100,7 @@ class Webshot(inkycal_module):
if internet_available():
logger.info('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise Exception('Network could not be reached :/')
logger.info(

View File

@ -68,7 +68,7 @@ class Xkcd(inkycal_module):
im_width = int(self.width - (2 * self.padding_left))
im_height = int(self.height - (2 * self.padding_top))
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)
im_black = Image.new('RGB', size=im_size, color='white')
@ -78,6 +78,7 @@ class Xkcd(inkycal_module):
if internet_available():
logger.info('Connection test passed')
else:
logger.error("Network not reachable. Please check your connection.")
raise Exception('Network could not be reached :/')
# Set some parameters for formatting feeds