mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
feat: allow disabling color output
This commit is contained in:
@@ -22,7 +22,7 @@ LOGFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|||||||
bufferHandler = FTBufferingHandler(1000)
|
bufferHandler = FTBufferingHandler(1000)
|
||||||
bufferHandler.setFormatter(Formatter(LOGFORMAT))
|
bufferHandler.setFormatter(Formatter(LOGFORMAT))
|
||||||
|
|
||||||
error_console = Console(stderr=True)
|
error_console = Console(stderr=True, color_system=None)
|
||||||
|
|
||||||
|
|
||||||
def get_existing_handlers(handlertype):
|
def get_existing_handlers(handlertype):
|
||||||
@@ -60,6 +60,9 @@ def setup_logging(config: Config) -> None:
|
|||||||
# Log level
|
# Log level
|
||||||
verbosity = config["verbosity"]
|
verbosity = config["verbosity"]
|
||||||
logging.root.addHandler(bufferHandler)
|
logging.root.addHandler(bufferHandler)
|
||||||
|
if config.get("print_colorized", True):
|
||||||
|
logger.info("Enabling colorized output")
|
||||||
|
error_console._color_system = "auto"
|
||||||
|
|
||||||
logfile = config.get("logfile")
|
logfile = config.get("logfile")
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ class FtRichHandler(Handler):
|
|||||||
# Format log message
|
# Format log message
|
||||||
log_time = Text(
|
log_time = Text(
|
||||||
datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3],
|
datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3],
|
||||||
style="gray46",
|
style="gray78",
|
||||||
)
|
)
|
||||||
name = Text(record.name)
|
name = Text(record.name, style="violet")
|
||||||
log_level = Text(record.levelname, style=f"logging.level.{record.levelname.lower()}")
|
log_level = Text(record.levelname, style=f"logging.level.{record.levelname.lower()}")
|
||||||
gray_sep = Text(" - ", style="gray46")
|
gray_sep = Text(" - ", style="gray46")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user