diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ee97c3..1f1b629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ### Unreleased -- Optimized chunking for streaming large files. +- File chunking has been optimized for streaming large static files. +- Server access logs are now redirected to ``stdout`` instead of ``stderr``. + This is intended to make it easier to use a log manager tool to split them + out from other server messages like startup information and error tracebacks. ### v0.5.0 (2020-07-14) diff --git a/jetforce/app/static.py b/jetforce/app/static.py index 854b793..ff801af 100644 --- a/jetforce/app/static.py +++ b/jetforce/app/static.py @@ -6,8 +6,6 @@ import subprocess import typing import urllib.parse -from twisted.protocols.basic import FileSender - from .base import JetforceApplication, Request, Response, RoutePattern, Status diff --git a/jetforce/protocol.py b/jetforce/protocol.py index 68a5f0a..3cd18b0 100644 --- a/jetforce/protocol.py +++ b/jetforce/protocol.py @@ -288,4 +288,4 @@ class GeminiProtocol(LineOnlyReceiver): # The connection ended before we got far enough to log anything pass else: - self.server.log_message(message) + self.server.log_access(message) diff --git a/jetforce/server.py b/jetforce/server.py index d34086a..092ac99 100644 --- a/jetforce/server.py +++ b/jetforce/server.py @@ -73,9 +73,15 @@ class GeminiServer(Factory): self.cafile = cafile self.capath = capath + def log_access(self, message: str) -> None: + """ + Log standard "access log"-type information. + """ + print(message, file=sys.stdout) + def log_message(self, message: str) -> None: """ - Log a diagnostic server message to stderr. + Log special messages like startup info or a traceback error. """ print(message, file=sys.stderr)