mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
修复日志 API 错误
This commit is contained in:
parent
a1c14ac2d9
commit
2e8917257e
@ -61,6 +61,8 @@ class LogApi:
|
||||
record["msg"],
|
||||
)).encode("utf-8") + b"\r\n")
|
||||
except Exception as e:
|
||||
await response.write(f"Module systemd.journal unavailable, switch to supervisord.\n{record}".encode("utf-8"))
|
||||
if record is None:
|
||||
record = e
|
||||
await response.write(f"Module systemd.journal is unavailable.\n{record}".encode("utf-8"))
|
||||
return response
|
||||
return response
|
||||
|
||||
@ -30,21 +30,19 @@ from xmlrpc.client import ServerProxy
|
||||
|
||||
from ...logging import get_logger
|
||||
|
||||
us_systemd_journal = True
|
||||
|
||||
try:
|
||||
module_name = "systemd.journal"
|
||||
module = __import__(module_name)
|
||||
except ImportError:
|
||||
import systemd.journal
|
||||
except ImportError as e:
|
||||
get_logger(0).error("Failed to import module: %s", "systemd.journal")
|
||||
us_systemd_journal = False
|
||||
get_logger(0).error("Failed to import module: %s", module_name)
|
||||
|
||||
try:
|
||||
module_name = "supervisor.xmlrpc"
|
||||
module = __import__(module_name)
|
||||
except ImportError:
|
||||
import supervisor.xmlrpc
|
||||
except ImportError as e:
|
||||
get_logger(0).info("Failed to import module: %s", "supervisor.xmlrpc")
|
||||
us_systemd_journal = True
|
||||
|
||||
|
||||
# =====
|
||||
class LogReader:
|
||||
async def poll_log(self, seek: int, follow: bool) -> AsyncGenerator[dict, None]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user