kas: define variable to store default log level
To make it easier to display (and modify) the default log level, especially with the introduction of the new (future commit) argument --log-level. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> [Jan: style fix] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
		
				
					committed by
					
						 Jan Kiszka
						Jan Kiszka
					
				
			
			
				
	
			
			
			
						parent
						
							88964d63b5
						
					
				
				
					commit
					246f23cbca
				
			| @@ -45,13 +45,15 @@ from . import plugins | |||||||
| __license__ = 'MIT' | __license__ = 'MIT' | ||||||
| __copyright__ = 'Copyright (c) Siemens AG, 2017-2018' | __copyright__ = 'Copyright (c) Siemens AG, 2017-2018' | ||||||
|  |  | ||||||
|  | default_log_level = 'info' | ||||||
|  |  | ||||||
|  |  | ||||||
| def create_logger(): | def create_logger(): | ||||||
|     """ |     """ | ||||||
|         Setup the logging environment |         Setup the logging environment | ||||||
|     """ |     """ | ||||||
|     log = logging.getLogger()  # root logger |     log = logging.getLogger()  # root logger | ||||||
|     log.setLevel(logging.INFO) |     log.setLevel(logging.getLevelName(default_log_level.upper())) | ||||||
|     format_str = '%(asctime)s - %(levelname)-8s - %(message)s' |     format_str = '%(asctime)s - %(levelname)-8s - %(message)s' | ||||||
|     date_format = '%Y-%m-%d %H:%M:%S' |     date_format = '%Y-%m-%d %H:%M:%S' | ||||||
|     if HAVE_COLORLOG and os.isatty(2): |     if HAVE_COLORLOG and os.isatty(2): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user