Olli Graf
2 years ago
4 changed files with 60 additions and 7 deletions
@ -0,0 +1,4 @@ |
|||||
|
import logging |
||||
|
__LOGLEVEL__ = logging.DEBUG |
||||
|
|
||||
|
|
@ -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 |
@ -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() |
Loading…
Reference in new issue