logger best practices

This commit is contained in:
aceisace
2022-10-03 02:56:04 +02:00
parent 9dff6e88cf
commit 560d73a87c
17 changed files with 47 additions and 58 deletions

View File

@@ -8,13 +8,13 @@ Copyright by aceisace
from inkycal.modules.template import inkycal_module
from inkycal.custom import *
import math, decimal
import math
import decimal
import arrow
from pyowm.owm import OWM
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger = logging.getLogger(__name__)
class Weather(inkycal_module):
@@ -102,7 +102,7 @@ class Weather(inkycal_module):
fonts['weathericons-regular-webfont'], size=self.fontsize)
# give an OK message
print(f"{filename} loaded")
print(f"{__name__} loaded")
def generate_image(self):
"""Generate image for this module"""
@@ -505,4 +505,4 @@ class Weather(inkycal_module):
if __name__ == '__main__':
print(f'running {filename} in standalone mode')
print(f'running {__name__} in standalone mode')