@Promezio/

PythonLogging

Python

No description

fork
loading
Files
  • main.py
  • log_config.ini
  • logs
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
#  :#/ promezio
#  www.promezio.it
#  Python: performance measurement
#  Check list vs set performance with timeit and cProfile
#


# import native logging libs
import logging
import logging.config



def test_logs():
  ''' A function that generates 5 logs of different levels '''

  print(":#/ promezio - TEST LOGS")
  logging.debug('Log @debug level')
  logging.info('Log @info level')
  logging.warning('Log @warning level')
  logging.error('Log @error level')
  logging.critical('Log @critical level')



# Main program
if __name__ == "__main__":
  # Load logging configuration from "log_config.ini" file
  logging.config.fileConfig("log_config.ini", disable_existing_loggers=False)

  # Generate test logs
  test_logs()