mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Refactor console logger
This commit is contained in:
parent
13321fb9b5
commit
565750e784
@ -26,6 +26,7 @@ class Console:
|
|||||||
prompt_out="",
|
prompt_out="",
|
||||||
not_found="Command \"%s\" not found in alias.",
|
not_found="Command \"%s\" not found in alias.",
|
||||||
debug=False) -> None:
|
debug=False) -> None:
|
||||||
|
self.__logger = get_logger("console")
|
||||||
self.__is_run = False
|
self.__is_run = False
|
||||||
self.__prompt_in = prompt_in
|
self.__prompt_in = prompt_in
|
||||||
self.__prompt_out = prompt_out
|
self.__prompt_out = prompt_out
|
||||||
@ -44,10 +45,11 @@ class Console:
|
|||||||
self.completer = NestedCompleter.from_nested_dict(self.__alias)
|
self.completer = NestedCompleter.from_nested_dict(self.__alias)
|
||||||
|
|
||||||
def __debug(self, *x):
|
def __debug(self, *x):
|
||||||
if self.__is_debug:
|
self.__logger.debug(f"{x}")
|
||||||
x = list(x)
|
# if self.__is_debug:
|
||||||
x.insert(0, "\r CONSOLE DEBUG:")
|
# x = list(x)
|
||||||
self.__print(*x)
|
# x.insert(0, "\r CONSOLE DEBUG:")
|
||||||
|
# self.__print(*x)
|
||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
print(item)
|
print(item)
|
||||||
@ -132,7 +134,8 @@ class Console:
|
|||||||
print_formatted_text(s)
|
print_formatted_text(s)
|
||||||
|
|
||||||
def log(self, s: AnyStr) -> None:
|
def log(self, s: AnyStr) -> None:
|
||||||
self.write(s)
|
self.__logger.log(f"\n{s}")
|
||||||
|
# self.write(s)
|
||||||
|
|
||||||
def __lshift__(self, s: AnyStr) -> None:
|
def __lshift__(self, s: AnyStr) -> None:
|
||||||
self.write(s)
|
self.write(s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user