Skip to content

Commit

Permalink
fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA committed Jul 30, 2024
1 parent a179976 commit 7f988b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import logging
import datetime
from typing import Optional
from pathlib import Path

from argparse import ArgumentParser, RawTextHelpFormatter
from configurator import configure
Expand All @@ -30,7 +31,8 @@
VEHICLES_DIR = os.path.join(REPO_DIR, "configs", "vehicles")
BINARY_OUTPUT_PATH = os.path.join(REPO_DIR, "firmware.bin")
LOG_FILENAME = f"log_{datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.log"
LOG_PATH = os.path.join(REPO_DIR, "logs", LOG_FILENAME)
LOGS_DIR = os.path.join(REPO_DIR, "logs")
LOG_PATH = os.path.join(LOGS_DIR, LOG_FILENAME)

COMMANDS = [
SimCommand(name="build", alias='b', mode=None, info="Build the Docker image"),
Expand Down Expand Up @@ -107,6 +109,7 @@ def process(self, command: Optional[str]) -> None:


def main():
Path(LOGS_DIR).mkdir(parents=True, exist_ok=True)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
filename=LOG_PATH,
Expand Down

0 comments on commit 7f988b7

Please sign in to comment.