Skip to content

Commit

Permalink
Update write_s3.py
Browse files Browse the repository at this point in the history
* add logging configuration
  • Loading branch information
tgrandje committed Jul 21, 2023
1 parent c3cfbf2 commit e59ee2e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions misc/write_s3.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
import os
from dotenv import load_dotenv
import s3fs
import logging

# os.chdir("cartiflette")

import cartiflette.s3 as s3
from cartiflette.download import get_administrative_level_available_ign

# Configuration du logger
script_file = os.path.basename(__file__)
script_file, _ext = os.path.splitext(script_file)
kwargs_log = {
"format": "%(levelname)s:%(asctime)s %(message)s",
"datefmt": "%m/%d/%Y %H:%M",
"level": logging.INFO,
}
file_handler = logging.FileHandler(
f"log_{script_file}.log", mode="w", encoding="utf8"
)
console_handler = logging.StreamHandler()
kwargs_log.update({"handlers": [file_handler, console_handler]})
logging.basicConfig(**kwargs_log)

# Chargement des éventuels tokens SSPCloud
load_dotenv()

bucket = "projet-cartiflette"
Expand Down

0 comments on commit e59ee2e

Please sign in to comment.