Home / File/ _logs.py — anthropic-sdk-python Source File

_logs.py — anthropic-sdk-python Source File

Architecture documentation for _logs.py, a python file in the anthropic-sdk-python codebase. 2 imports, 0 dependents.

File python AnthropicClient SyncAPI 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  9ee341c1_cb2e_bfd0_6bd3_0e4d237fbb62["_logs.py"]
  bb0af148_44a9_df40_49c4_0fa6ceb5a403["os"]
  9ee341c1_cb2e_bfd0_6bd3_0e4d237fbb62 --> bb0af148_44a9_df40_49c4_0fa6ceb5a403
  33e7b7bd_cc48_e59c_0e93_20dce57f27ca["logging"]
  9ee341c1_cb2e_bfd0_6bd3_0e4d237fbb62 --> 33e7b7bd_cc48_e59c_0e93_20dce57f27ca
  style 9ee341c1_cb2e_bfd0_6bd3_0e4d237fbb62 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import os
import logging

logger: logging.Logger = logging.getLogger("anthropic")
httpx_logger: logging.Logger = logging.getLogger("httpx")


def _basic_config() -> None:
    # e.g. [2023-10-05 14:12:26 - anthropic._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
    logging.basicConfig(
        format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s",
        datefmt="%Y-%m-%d %H:%M:%S",
    )


def setup_logging() -> None:
    env = os.environ.get("ANTHROPIC_LOG")
    if env == "debug":
        _basic_config()
        logger.setLevel(logging.DEBUG)
        httpx_logger.setLevel(logging.DEBUG)
    elif env == "info":
        _basic_config()
        logger.setLevel(logging.INFO)
        httpx_logger.setLevel(logging.INFO)

Subdomains

Dependencies

  • logging
  • os

Frequently Asked Questions

What does _logs.py do?
_logs.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What functions are defined in _logs.py?
_logs.py defines 2 function(s): _basic_config, setup_logging.
What does _logs.py depend on?
_logs.py imports 2 module(s): logging, os.
Where is _logs.py in the architecture?
_logs.py is located at src/anthropic/_utils/_logs.py (domain: AnthropicClient, subdomain: SyncAPI, directory: src/anthropic/_utils).

Analyze Your Own Codebase

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

Try Supermodel Free