mirror of
https://github.com/esphome/esphome.git
synced 2025-09-07 13:52:20 +01:00
Add log level env var (#7604)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -67,20 +67,18 @@ class ESPHomeLogFormatter(logging.Formatter):
|
||||
|
||||
|
||||
def setup_log(
|
||||
debug: bool = False, quiet: bool = False, include_timestamp: bool = False
|
||||
log_level=logging.INFO,
|
||||
include_timestamp: bool = False,
|
||||
) -> None:
|
||||
import colorama
|
||||
|
||||
colorama.init()
|
||||
|
||||
if debug:
|
||||
log_level = logging.DEBUG
|
||||
if log_level == logging.DEBUG:
|
||||
CORE.verbose = True
|
||||
elif quiet:
|
||||
log_level = logging.CRITICAL
|
||||
elif log_level == logging.CRITICAL:
|
||||
CORE.quiet = True
|
||||
else:
|
||||
log_level = logging.INFO
|
||||
|
||||
logging.basicConfig(level=log_level)
|
||||
|
||||
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
||||
|
Reference in New Issue
Block a user