mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Use rich logging for Pelican server
This commit is contained in:
parent
e2c73a0a16
commit
0b9a488c26
2 changed files with 6 additions and 2 deletions
|
|
@ -487,8 +487,8 @@ def listen(server, port, output, excqueue=None):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print("\nServing site at: http://{}:{} - Tap CTRL-C to stop".format(
|
console.print("Serving site at: http://{}:{} - Tap CTRL-C to stop".format(
|
||||||
server, port))
|
server, port))
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if excqueue is not None:
|
if excqueue is not None:
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
magic_from_file = None
|
magic_from_file = None
|
||||||
|
|
||||||
|
from pelican.log import console # noqa: F401
|
||||||
from pelican.log import init as init_logging
|
from pelican.log import init as init_logging
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -104,6 +105,9 @@ class ComplexHTTPRequestHandler(server.SimpleHTTPRequestHandler):
|
||||||
|
|
||||||
return mimetype
|
return mimetype
|
||||||
|
|
||||||
|
def log_message(self, format, *args):
|
||||||
|
logger.info(format, *args)
|
||||||
|
|
||||||
|
|
||||||
class RootedHTTPServer(server.HTTPServer):
|
class RootedHTTPServer(server.HTTPServer):
|
||||||
def __init__(self, base_path, *args, **kwargs):
|
def __init__(self, base_path, *args, **kwargs):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue