from http.server import SimpleHTTPRequestHandler, HTTPServer

class MyHandler(SimpleHTTPRequestHandler):
    def guess_type(self, path):
        if path.endswith(".log"):
            return "text/plain; charset=utf-8"
        return super().guess_type(path)

server = HTTPServer(("0.0.0.0", 8123), MyHandler)
print("Serving on port 8123")
server.serve_forever()