mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-23 17:01:28 -04:00
Change the dir structure slightly
This commit is contained in:
parent
6b6fe21db3
commit
2f4a9638c0
184 changed files with 0 additions and 21 deletions
21
source_code/USEFUL/basic_examples/example_logging.py
Normal file
21
source_code/USEFUL/basic_examples/example_logging.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
||||
import logging
|
||||
|
||||
LOG_FILENAME = 'logging_example.out'
|
||||
logging.basicConfig(filename=LOG_FILENAME,
|
||||
level=logging.DEBUG,
|
||||
)
|
||||
|
||||
logging.debug('This message should go to the log file')
|
||||
|
||||
f = open(LOG_FILENAME, 'rt')
|
||||
try:
|
||||
body = f.read()
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
print 'FILE:'
|
||||
print body
|
Loading…
Add table
Add a link
Reference in a new issue