跳到内容

dspy.enable_logging

dspy.enable_logging()

启用贯穿 DSPy 的事件日志 API(eprint()logger.info() 等)使用的 DSPyLoggingStream,发出所有后续事件日志。这会撤销 disable_logging() 的效果。

源代码位于 dspy/utils/logging_utils.py
def enable_logging():
    """
    Enables the `DSPyLoggingStream` used by event logging APIs throughout DSPy
    (`eprint()`, `logger.info()`, etc), emitting all subsequent event logs. This
    reverses the effects of `disable_logging()`.
    """
    DSPY_LOGGING_STREAM.enabled = True