fix: configure logging for file-writing
This commit is contained in:
parent
807a4804ef
commit
d1a2786c6e
1 changed files with 5 additions and 1 deletions
|
@ -18,7 +18,10 @@ import pydantic
|
||||||
import boto3
|
import boto3
|
||||||
|
|
||||||
logger = logging.getLogger(__file__)
|
logger = logging.getLogger(__file__)
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(
|
||||||
|
filename="/var/log/backup-volumes.log", encoding="utf-8", level=logging.INFO
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Config(pydantic.BaseModel):
|
class Config(pydantic.BaseModel):
|
||||||
# List of volumes to back up.
|
# List of volumes to back up.
|
||||||
|
@ -62,6 +65,7 @@ if __name__ == "__main__":
|
||||||
config_path = sys.argv[1]
|
config_path = sys.argv[1]
|
||||||
|
|
||||||
if not pathlib.Path(config_path).exists():
|
if not pathlib.Path(config_path).exists():
|
||||||
|
logger.error("Did not find configuration file at %s.", config_path)
|
||||||
raise RuntimeError(f"Did not find configuration at {config_path}")
|
raise RuntimeError(f"Did not find configuration at {config_path}")
|
||||||
|
|
||||||
config = Config.parse_file(config_path)
|
config = Config.parse_file(config_path)
|
||||||
|
|
Loading…
Reference in a new issue