Implement initial project structure with logging and token fetching functionality
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from config import LOG_FOLDER
|
||||
|
||||
|
||||
def setup_logging():
|
||||
logs_dir = Path(LOG_FOLDER)
|
||||
logs_dir.mkdir(exist_ok=True)
|
||||
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S_%f")[:-3]
|
||||
log_filename = logs_dir / f"polymarket_hft_{timestamp}.log"
|
||||
|
||||
log_format = "%(asctime)s.%(msecs)03d - %(name)s - %(levelname)s - %(message)s"
|
||||
date_format = "%Y-%m-%d %H:%M:%S"
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format=log_format,
|
||||
datefmt=date_format,
|
||||
handlers=[
|
||||
logging.FileHandler(log_filename, encoding="utf-8"),
|
||||
logging.StreamHandler(),
|
||||
],
|
||||
)
|
||||
|
||||
return logging.getLogger(__name__)
|
||||
Reference in New Issue
Block a user