向nonebot对齐了一下日志输出
This commit is contained in:
@@ -25,6 +25,7 @@ class FetchData:
|
||||
instance.card_paths = data.get("card_paths", [])
|
||||
return instance
|
||||
|
||||
|
||||
class SekaiSyncLib:
|
||||
def __init__(self):
|
||||
self.lib = ctypes.CDLL(os.path.join(os.path.dirname(__file__), get_lib_filename("sekai_sync_lib")))
|
||||
@@ -39,6 +40,10 @@ class SekaiSyncLib:
|
||||
self.lib.ghp.argtypes = [ctypes.c_char_p]
|
||||
self.lib.ghp.restype = None
|
||||
|
||||
# ghp(x: *const c_char)
|
||||
self.lib.log_level.argtypes = [ctypes.c_char_p]
|
||||
self.lib.log_level.restype = None
|
||||
|
||||
# boot(cwd: *const c_char, name: *const c_char, as_path: *const c_char) -> c_int
|
||||
self.lib.boot.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
|
||||
self.lib.boot.restype = ctypes.c_int
|
||||
@@ -71,6 +76,10 @@ class SekaiSyncLib:
|
||||
"""设置 GitHub Token,传 None 或空字符串可清除"""
|
||||
self.lib.ghp(self._str_to_bytes(token))
|
||||
|
||||
def set_log_level(self, log_evel: Optional[str]):
|
||||
"""设置 Log level,传 None 或空字符串可清除"""
|
||||
self.lib.log_level(self._str_to_bytes(log_evel))
|
||||
|
||||
def boot(self, cwd: str, name: str, as_path: str) -> int:
|
||||
"""
|
||||
启动主循环与初始化状态
|
||||
@@ -109,4 +118,5 @@ class SekaiSyncLib:
|
||||
# 4. 无论是否发生 JSON 解析异常,绝对保证释放 Rust 内存!
|
||||
self.lib.free_string(ptr)
|
||||
|
||||
rlib = SekaiSyncLib()
|
||||
|
||||
rlib = SekaiSyncLib()
|
||||
|
||||
Reference in New Issue
Block a user