app: Force register moonraker and klippy log endpoints
It is possible for the log files to be registered after a rollover, which can result in the file not existing. Force the log endpoints to register, bypassing the existance check. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
67f5b32d84
commit
ae3661b100
@ -132,9 +132,10 @@ class MoonrakerApp:
|
|||||||
# Register handlers
|
# Register handlers
|
||||||
logfile = config['system_args'].get('logfile')
|
logfile = config['system_args'].get('logfile')
|
||||||
if logfile:
|
if logfile:
|
||||||
self.register_static_file_handler("moonraker.log", logfile)
|
|
||||||
self.register_static_file_handler(
|
self.register_static_file_handler(
|
||||||
"klippy.log", DEFAULT_KLIPPY_LOG_PATH)
|
"moonraker.log", logfile, force=True)
|
||||||
|
self.register_static_file_handler(
|
||||||
|
"klippy.log", DEFAULT_KLIPPY_LOG_PATH, force=True)
|
||||||
self.auth.register_handlers(self)
|
self.auth.register_handlers(self)
|
||||||
|
|
||||||
def listen(self, host, port):
|
def listen(self, host, port):
|
||||||
@ -197,10 +198,10 @@ class MoonrakerApp:
|
|||||||
self.wsm.register_local_handler(api_def, callback)
|
self.wsm.register_local_handler(api_def, callback)
|
||||||
logging.info(msg)
|
logging.info(msg)
|
||||||
|
|
||||||
def register_static_file_handler(self, pattern, file_path):
|
def register_static_file_handler(self, pattern, file_path, force=False):
|
||||||
if pattern[0] != "/":
|
if pattern[0] != "/":
|
||||||
pattern = "/server/files/" + pattern
|
pattern = "/server/files/" + pattern
|
||||||
if os.path.isfile(file_path):
|
if os.path.isfile(file_path) or force:
|
||||||
pattern += '()'
|
pattern += '()'
|
||||||
elif os.path.isdir(file_path):
|
elif os.path.isdir(file_path):
|
||||||
if pattern[-1] != "/":
|
if pattern[-1] != "/":
|
||||||
|
@ -77,8 +77,10 @@ class FileManager:
|
|||||||
|
|
||||||
# Register log path
|
# Register log path
|
||||||
log_file = paths.get('log_file')
|
log_file = paths.get('log_file')
|
||||||
|
if log_file is not None:
|
||||||
log_path = os.path.normpath(os.path.expanduser(log_file))
|
log_path = os.path.normpath(os.path.expanduser(log_file))
|
||||||
self.server.register_static_file_handler("klippy.log", log_path)
|
self.server.register_static_file_handler(
|
||||||
|
"klippy.log", log_path, force=True)
|
||||||
|
|
||||||
def register_directory(self, root, path):
|
def register_directory(self, root, path):
|
||||||
if path is None:
|
if path is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user