mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
chore: add "log init from config" ...
This commit is contained in:
@@ -53,18 +53,63 @@ def setup_logging_pre() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
logging_config = {
|
||||||
|
"version": 1,
|
||||||
|
# "incremental": True,
|
||||||
|
# "disable_existing_loggers": False,
|
||||||
|
"formatters": {
|
||||||
|
"basic": {"format": "%(message)s"},
|
||||||
|
"standard": {
|
||||||
|
"format": LOGFORMAT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"handlers": {
|
||||||
|
"console": {
|
||||||
|
"class": "freqtrade.loggers.ft_rich_handler.FtRichHandler",
|
||||||
|
"console": error_console,
|
||||||
|
"formatter": "basic",
|
||||||
|
# "class": "logging.StreamHandler",
|
||||||
|
# "formatter": "standard",
|
||||||
|
# "stream": "ext://sys.stdout",
|
||||||
|
},
|
||||||
|
"file": {
|
||||||
|
"class": "logging.handlers.RotatingFileHandler",
|
||||||
|
"formatter": "standard",
|
||||||
|
"filename": "whatever.log",
|
||||||
|
"maxBytes": 1024 * 1024 * 10, # 10Mb
|
||||||
|
"backupCount": 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"loggers": {
|
||||||
|
"freqtrade": {
|
||||||
|
# "handlers": ["console", "file"],
|
||||||
|
"level": "INFO",
|
||||||
|
"propagate": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"handlers": ["console", "file"],
|
||||||
|
"level": "INFO",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def setup_logging(config: Config) -> None:
|
def setup_logging(config: Config) -> None:
|
||||||
"""
|
"""
|
||||||
Process -v/--verbose, --logfile options
|
Process -v/--verbose, --logfile options
|
||||||
"""
|
"""
|
||||||
# Log level
|
# Log level
|
||||||
verbosity = config["verbosity"]
|
verbosity = config["verbosity"]
|
||||||
|
|
||||||
|
logging.config.dictConfig(logging_config)
|
||||||
|
|
||||||
logging.root.addHandler(bufferHandler)
|
logging.root.addHandler(bufferHandler)
|
||||||
if config.get("print_colorized", True):
|
if config.get("print_colorized", True):
|
||||||
logger.info("Enabling colorized output.")
|
logger.info("Enabling colorized output.")
|
||||||
error_console._color_system = error_console._detect_color_system()
|
error_console._color_system = error_console._detect_color_system()
|
||||||
|
|
||||||
logfile = config.get("logfile")
|
logfile = config.get("logfile")
|
||||||
|
logging.info("Logfile configured")
|
||||||
|
|
||||||
if logfile:
|
if logfile:
|
||||||
s = logfile.split(":")
|
s = logfile.split(":")
|
||||||
|
|||||||
Reference in New Issue
Block a user