Skip to content

Commit 2643640

Browse files
committed
Add logging to download script
1 parent f6a7809 commit 2643640

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lerobot/scripts/download.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@
2222
MAX_SLEEP_SECONDS = 120
2323
DEFAULT_OUTPUT_DIR = "~/.cache/huggingface/lerobot/"
2424

25+
# Setup logging with file output
26+
_log_dir = Path("logs/download")
27+
_log_dir.mkdir(parents=True, exist_ok=True)
28+
_file_handler = logging.FileHandler(_log_dir / "download.log")
29+
_file_handler.setFormatter(logging.Formatter("%(asctime)s | %(levelname)s | %(message)s", datefmt="%H:%M:%S"))
30+
2531
logging.basicConfig(
2632
level=logging.INFO,
2733
format="%(asctime)s | %(levelname)s | %(message)s",
2834
datefmt="%H:%M:%S",
35+
handlers=[logging.StreamHandler(), _file_handler],
2936
)
3037
LOGGER = logging.getLogger("hub-download")
3138

0 commit comments

Comments
 (0)