def log():
return logging.getLogger('pysawsim')
-_log = log()
-_log.setLevel(logging.DEBUG)
-_console = logging.StreamHandler()
-_formatter = logging.Formatter('%(name)-8s: %(levelname)-6s %(message)s')
-_console.setFormatter(_formatter)
-_log.addHandler(_console)
-del(_log)
-del(_console)
-del(_formatter)
+def add_stderr_log_handler(level=logging.DEBUG):
+ _log = log()
+ _log.setLevel(level)
+ console = logging.StreamHandler()
+ formatter = logging.Formatter('%(name)-8s: %(levelname)-6s %(message)s')
+ console.setFormatter(formatter)
+ _log.addHandler(console)
+
+add_stderr_log_handler(logging.WARNING)