agentscope.logging module

Logging utilities.

agentscope.logging.log_stream_msg(msg: Msg, last: bool = True) None[源代码]

Print the message in different streams, including terminal, studio, and gradio if it is active.

参数:
  • msg (Msg) – The message object to be printed.

  • last (bool, defaults to True) – True if this is the last message in the stream or a single message. Otherwise, False.

agentscope.logging.log_msg(msg: Msg, disable_gradio: bool = False) None[源代码]

Print the message and save it into files. Note the message should be a Msg object.

agentscope.logging.log_gradio(msg: Msg, uid: str, **kwargs: Any) None[源代码]

Send chat message to studio.

参数:
  • msg (Msg) – The message to be logged.

  • uid (str) – The local value ‘uid’ of the thread.

agentscope.logging.setup_logger(path_log: str | None = None, level: Literal['TRACE', 'DEBUG', 'INFO', 'SUCCESS', 'WARNING', 'ERROR', 'CRITICAL'] = 'INFO') None[源代码]

Setup loguru.logger and redirect stderr to logging.

参数:
  • path_log (str, defaults to “”) – The directory of log files.

  • level (str, defaults to “INFO”) – The logging level, which is one of the following: “TRACE”, “DEBUG”, “INFO”, “SUCCESS”, “WARNING”, “ERROR”, “CRITICAL”.