This commit is contained in:
@@ -9,10 +9,28 @@ import requests
|
|||||||
# format='%(asctime)s - %(levelname)s - %(message)s')
|
# format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
def configure_logging(log_path="/sdsat/logs/registrator.log"):
|
def configure_logging(log_path="/sdsat/logs/registrator.log"):
|
||||||
|
current_file = Path(__file__).resolve()
|
||||||
|
sdsat_root = current_file.parent.parent
|
||||||
|
log_dir = sdsat_root / "logs"
|
||||||
|
log_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
log_file = log_dir / "registrator.log"
|
||||||
|
|
||||||
|
handler = RotatingFileHandler(
|
||||||
|
log_file,
|
||||||
|
maxBytes=5 * 1024 * 1024,
|
||||||
|
backupCount=3,
|
||||||
|
)
|
||||||
|
|
||||||
|
formatter = logging.Formatter(
|
||||||
|
"%(asctime)s - %(levelname)s - %(message)s"
|
||||||
|
)
|
||||||
|
|
||||||
|
handler.setFormatter(formatter)
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
filename=log_path,
|
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format="%(asctime)s - %(levelname)s - %(message)s",
|
handlers=[handler],
|
||||||
)
|
)
|
||||||
|
|
||||||
ip='69.69.69.69'
|
ip='69.69.69.69'
|
||||||
|
|||||||
Reference in New Issue
Block a user