Skip to content

Commit bb3e8a1

Browse files
committed
Add overrides for HTTP logging
1 parent 9fb11f8 commit bb3e8a1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/classes/thumbnail.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from threading import Thread
3434
from classes import info
3535
from classes.query import File
36+
from classes.logger import log
3637
from http.server import BaseHTTPRequestHandler, HTTPServer
3738
from socketserver import ThreadingMixIn
3839

@@ -54,7 +55,7 @@ def GenerateThumbnail(file_path, thumb_path, thumbnail_frame, width, height, mas
5455
try:
5556
if reader.info.metadata.count("rotate"):
5657
rotate = float(reader.info.metadata.find("rotate").value()[1])
57-
except:
58+
except Exception:
5859
pass
5960

6061
# Create thumbnail folder (if needed)
@@ -99,6 +100,14 @@ def run(self):
99100
class httpThumbnailHandler(BaseHTTPRequestHandler):
100101
""" This class handles HTTP requests to the HTTP thumbnail server above."""
101102

103+
def log_message(self, msg_format, *args):
104+
""" Log message from HTTPServer """
105+
log.info(msg_format % args)
106+
107+
def log_error(self, msg_format, *args):
108+
""" Log error from HTTPServer """
109+
log.error(msg_format % args)
110+
102111
def do_GET(self):
103112
# Pause processing of request (since we don't currently use thread pooling, this allows
104113
# the threads to be processed without choking the CPU as much

0 commit comments

Comments
 (0)