Skip to content

Commit 44e9175

Browse files
feat:logging
1 parent 83df488 commit 44e9175

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

logging_tut/logging_main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import logging
2+
3+
def function_to_log():
4+
logging.basicConfig(filename='logging.log', filemode='w', format='%(asctime)s %(message)s')
5+
logger = logging.getLogger()
6+
logger.setLevel(logging.DEBUG)
7+
logger.info('INFO')
8+
logger.error('ERROR')
9+
logger.warning('WARNING')
10+
logger.critical('CRITICAL')
11+
logger.debug('DEBUG')
12+
13+
if __name__ == '__main__':
14+
function_to_log()

0 commit comments

Comments
 (0)