Skip to content

Commit

Permalink
Add overrides for HTTP logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Nov 20, 2019
1 parent 9fb11f8 commit bb3e8a1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/classes/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from threading import Thread
from classes import info
from classes.query import File
from classes.logger import log
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn

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

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

def log_message(self, msg_format, *args):
""" Log message from HTTPServer """
log.info(msg_format % args)

def log_error(self, msg_format, *args):
""" Log error from HTTPServer """
log.error(msg_format % args)

def do_GET(self):
# Pause processing of request (since we don't currently use thread pooling, this allows
# the threads to be processed without choking the CPU as much
Expand Down

0 comments on commit bb3e8a1

Please sign in to comment.