Split out access logs, fixes #37
This commit is contained in:
parent
57556e09f5
commit
7215195b8c
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
### Unreleased
|
### 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)
|
### v0.5.0 (2020-07-14)
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ import subprocess
|
||||||
import typing
|
import typing
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
from twisted.protocols.basic import FileSender
|
|
||||||
|
|
||||||
from .base import JetforceApplication, Request, Response, RoutePattern, Status
|
from .base import JetforceApplication, Request, Response, RoutePattern, Status
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -288,4 +288,4 @@ class GeminiProtocol(LineOnlyReceiver):
|
||||||
# The connection ended before we got far enough to log anything
|
# The connection ended before we got far enough to log anything
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.server.log_message(message)
|
self.server.log_access(message)
|
||||||
|
|
|
@ -73,9 +73,15 @@ class GeminiServer(Factory):
|
||||||
self.cafile = cafile
|
self.cafile = cafile
|
||||||
self.capath = capath
|
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:
|
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)
|
print(message, file=sys.stderr)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue