Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in logging.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6bf85540_6182_b16b_a8eb_15658ffb746e["__init__()"]
  842d2d2b_a22f_fcd2_b679_3f83339b04f4["LoggingCallbackHandler"]
  6bf85540_6182_b16b_a8eb_15658ffb746e -->|defined in| 842d2d2b_a22f_fcd2_b679_3f83339b04f4
  style 6bf85540_6182_b16b_a8eb_15658ffb746e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/callbacks/tracers/logging.py lines 18–38

    def __init__(
        self,
        logger: logging.Logger,
        log_level: int = logging.INFO,
        extra: dict | None = None,
        **kwargs: Any,
    ) -> None:
        """Initialize the LoggingCallbackHandler.

        Args:
            logger: the logger to use for logging
            log_level: the logging level (default: logging.INFO)
            extra: the extra context to log (default: None)
            **kwargs: additional keyword arguments.
        """
        log_method = getattr(logger, logging.getLevelName(level=log_level).lower())

        def callback(text: str) -> None:
            log_method(text, extra=extra)

        super().__init__(function=callback, **kwargs)

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/callbacks/tracers/logging.py.
Where is __init__() defined?
__init__() is defined in libs/langchain/langchain_classic/callbacks/tracers/logging.py at line 18.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free