115 lines
3.6 KiB
Python
115 lines
3.6 KiB
Python
import os
|
|
|
|
current_directory = os.path.dirname(os.path.abspath(__file__))
|
|
log_directory = os.path.join(current_directory, 'loggers')
|
|
os.makedirs(log_directory, exist_ok=True)
|
|
log_filename = os.path.join(log_directory, 'app.log')
|
|
|
|
LOGGING_CONFIG = {
|
|
"version": 1,
|
|
"disable_existing_loggers": False,
|
|
"formatters": {
|
|
"default": {
|
|
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
"datefmt": "%Y-%m-%d %H:%M:%S", # Формат даты
|
|
},
|
|
},
|
|
"handlers": {
|
|
"timed_rotating_file": {
|
|
"class": "logging.handlers.TimedRotatingFileHandler",
|
|
"filename": log_filename,
|
|
"when": "midnight", # Время ротации (каждую полночь)
|
|
"interval": 1, # Интервал в днях
|
|
"backupCount": 7, # Количество сохраняемых архивов (0 - не сохранять)
|
|
"formatter": "default",
|
|
"encoding": "utf-8",
|
|
},
|
|
"console": {
|
|
"class": "logging.StreamHandler",
|
|
"formatter": "default",
|
|
},
|
|
},
|
|
"loggers": {
|
|
"main": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"add_bybit_api": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"balance": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"functions": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"futures": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"get_valid_symbol": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"min_qty": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"price_symbol": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"requests": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"handlers": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"conditions_settings": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"main_settings": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"risk_management_settings": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"models": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"bybit_ws": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
"tasks": {
|
|
"handlers": ["console", "timed_rotating_file"],
|
|
"level": "DEBUG",
|
|
"propagate": False,
|
|
},
|
|
},
|
|
}
|