Skip to content

Commit a6cdaf4

Browse files
committed
refactor: improve logging
1 parent ad8c832 commit a6cdaf4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
web: gunicorn --bind=0.0.0.0:8000 --workers=4 --timeout 120 --forwarded-allow-ips=* infographics.wsgi:application
1+
web: gunicorn --bind=0.0.0.0:8000 --workers=4 --timeout 120 --log-level debug --forwarded-allow-ips=* infographics.wsgi:application
22
migrate: python manage.py migrate

video/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ class Video(models.Model):
2828
)
2929
file_framerate = models.PositiveIntegerField(blank=True, null=True)
3030

31+
def __str__(self):
32+
return f"video {self.id}"
33+
3134
def generate_video(self, framerate: int):
3235
"""
3336
Generates the video using the png frames.
@@ -48,7 +51,7 @@ def generate_video(self, framerate: int):
4851
shutil.copy(frame.png.path, os.path.join(dir, f"{istr}.png"))
4952
input = os.path.join(dir, "%06d.png")
5053
output = os.path.join(dir, "output.webm")
51-
logger.info(f"[{self.id}] generating...")
54+
logger.info(f"[{self}] generating...")
5255
subprocess.run(
5356
[
5457
"ffmpeg",
@@ -67,7 +70,7 @@ def generate_video(self, framerate: int):
6770
check=True,
6871
capture_output=True,
6972
)
70-
logger.info(f"[{self.id}] generated file")
73+
logger.info(f"[{self}] generated file")
7174
self.file_framerate = framerate
7275
with open(output, "rb") as f:
7376
self.file.save(f"video-{self.id}.webm", f)

0 commit comments

Comments
 (0)