MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / main

Function main

src/13/simple_logging_for_scripts/example1.py:3–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import logging
2
3def main():
4 # Configure the logging system
5 logging.basicConfig(
6 filename='app.log',
7 level=logging.ERROR
8 )
9
10 # Variables (to make the calls that follow work)
11 hostname = 'www.python.org'
12 item = 'spam'
13 filename = 'data.csv'
14 mode = 'r'
15
16 # Example logging calls (insert into your program)
17 logging.critical('Host %s unknown', hostname)
18 logging.error("Couldn't find %r", item)
19 logging.warning('Feature is deprecated')
20 logging.info('Opening file %r, mode=%r', filename, mode)
21 logging.debug('Got here')
22
23if __name__ == '__main__':
24 main()

Callers 1

example1.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected