Ved-vampir | 0c7e2d4 | 2015-03-18 17:18:47 +0300 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | """ Logger initialization """ |
| 3 | |
| 4 | import logging |
| 5 | |
| 6 | |
| 7 | def define_logger(name): |
| 8 | """ Initialization of logger""" |
| 9 | logger = logging.getLogger(name) |
| 10 | logger.setLevel(logging.INFO) |
| 11 | ch = logging.StreamHandler() |
| 12 | ch.setLevel(logging.INFO) |
| 13 | logger.addHandler(ch) |
| 14 | |
| 15 | log_format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s' |
| 16 | formatter = logging.Formatter(log_format, |
| 17 | "%H:%M:%S") |
| 18 | ch.setFormatter(formatter) |
| 19 | return logger |