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

@@ -38,8 +38,7 @@ except ImportError:
#############################################################################
# Get the name of this file, set up logging for this filename
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger = logging.getLogger(__name__)
#############################################################################
@@ -159,7 +158,7 @@ class Simple(inkycal_module):
# -----------------------------------------------------------------------#
# give an OK message
print(f'{filename} loaded')
print(f'{__name__} loaded')
#############################################################################
# Validation of module specific parameters (optional) #
@@ -220,7 +219,7 @@ class Simple(inkycal_module):
if __name__ == '__main__':
print('running {0} in standalone mode'.format(filename))
print('running {0} in standalone mode'.format(__name__))
################################################################################
# Last steps