agentscope.logging module

Logging utilities.

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

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

Parameters:
  • 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[source]

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[source]

Send chat message to studio.

Parameters:
  • 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[source]

Setup loguru.logger and redirect stderr to logging.

Parameters:
  • 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”.