logging
This commit is contained in:
4
logging/conf.py
Normal file
4
logging/conf.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import logging
|
||||
__LOGLEVEL__ = logging.DEBUG
|
||||
|
||||
|
5
logging/test.log
Normal file
5
logging/test.log
Normal file
@@ -0,0 +1,5 @@
|
||||
2023-04-29 13:11:26,397 [DEBUG] testlogging: DEBUG/Drucken wir vorbereitet
|
||||
2023-04-29 13:11:26,397 [INFO] testlogging: INFO/Es werden 2 Seiten gedruckt
|
||||
2023-04-29 13:11:26,397 [WARNING] testlogging: WARN/nicht genügend Papier im Drucker
|
||||
2023-04-29 13:11:26,397 [ERROR] testlogging: ERROR/Drucker nicht gefunden.
|
||||
2023-04-29 13:11:26,397 [CRITICAL] testlogging: CRITICAL/Drucker brennt
|
17
logging/testlogging.py
Normal file
17
logging/testlogging.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import logging
|
||||
from conf import __LOGLEVEL__
|
||||
|
||||
logging.basicConfig( format='%(asctime)s [%(levelname)s] %(funcName)s: %(message)s',
|
||||
# filename='test.log',
|
||||
level=__LOGLEVEL__)
|
||||
|
||||
def testlogging():
|
||||
print('testlogging() aufgerufen.')
|
||||
logging.debug('DEBUG/Druckdaten werden gesendet.')
|
||||
logging.info('INFO/Es werden 2 Seiten gedruckt')
|
||||
logging.warning('WARN/nicht genügend Papier im Drucker')
|
||||
logging.error('ERROR/Drucker nicht gefunden.')
|
||||
logging.critical('CRITICAL/Drucker brennt')
|
||||
|
||||
if __name__ == '__main__':
|
||||
testlogging()
|
Reference in New Issue
Block a user