npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

claude-code-logger

v1.0.2

Published

HTTP/HTTPS proxy logger for analyzing Claude Code traffic with enhanced chat mode visualization

Readme

Claude Code Logger

A specialized HTTP/HTTPS proxy logger designed for analyzing and debugging Claude Code traffic with enhanced chat mode visualization.

🎯 Primary Purpose

This tool was built specifically to help developers understand and debug the communication between Claude Code and the Anthropic API. It provides a clean, formatted view of the conversation flow, making it easier to:

  • Debug Claude Code behavior
  • Analyze API requests and responses
  • Monitor token usage and quotas
  • Understand the structure of system prompts and tool usage
  • Archive conversations for later analysis

🚀 Quick Start (No Installation Required!)

Simply run these two commands in separate terminals:

Terminal 1 - Start the logger:

npx claude-code-logger start

Terminal 2 - Start Claude Code with proxy:

ANTHROPIC_BASE_URL=http://localhost:8000/ claude

That's it! You'll now see a beautifully formatted log of all Claude Code interactions in your terminal.

For help and options:

npx claude-code-logger start --help

✨ Features

Claude Code Specific

  • 🤖 Chat Mode: Automatically enabled by default, shows only the conversation between you and Claude
  • 📝 Markdown Rendering: AI responses are rendered with proper formatting (lists, code blocks, emphasis)
  • 🔍 System Prompt Visibility: See system reminders, file contents, and context provided to Claude
  • 🔧 Tool Usage Tracking: Monitor when Claude uses tools like file reading, editing, or web searches
  • 📊 Verbose Mode: Use -v flag to see full prompts without truncation

General Proxy Features

  • ✅ HTTP and HTTPS Support: Works with both protocols
  • ✅ Request/Response Logging: Detailed logging of all traffic
  • ✅ Body Content Logging: Optional logging of request/response bodies
  • ✅ Server-Sent Events (SSE): Proper handling and merging of streaming responses
  • ✅ Compression Support: Handles gzip, deflate, and brotli compressed responses
  • ✅ Parallel Request Handling: Efficiently handles multiple concurrent requests

📋 All CLI Options

claude-code-logger start [options]

Options:
  -p, --port <port>         Local port to listen on (default: 8000)
  -h, --host <host>         Remote host address (default: api.anthropic.com)
  -r, --remote-port <port>  Remote port (default: 443)
  --https                   Use HTTPS for remote connection (default: true)
  --local-https             Accept HTTPS connections locally (default: false)
  --log-body                Log request and response bodies (default: false)
  --merge-sse               Merge Server-Sent Events into readable messages (default: false)
  --debug                   Show debug messages for troubleshooting (default: false)
  --chat-mode               Show only chat conversation with live streaming (default: true)
  -v, --verbose             Show full prompts without truncation (default: false)

🔍 Usage Examples

Claude Code Logging (Primary Use Case)

# Basic usage - logs Claude Code conversations
npm run dev -- start
ANTHROPIC_BASE_URL=http://localhost:8000/ claude

# With full prompt visibility
npm run dev -- start --verbose
ANTHROPIC_BASE_URL=http://localhost:8000/ claude

# With debug information
npm run dev -- start --debug
ANTHROPIC_BASE_URL=http://localhost:8000/ claude

# Log to file for later analysis
npm run dev -- start 2>&1 | tee claude-session-$(date +%Y%m%d-%H%M%S).log

General Proxy Usage

# Proxy any HTTP service
npm run dev -- start -p 3000 -h example.com -r 80 --https=false --chat-mode=false

# Log all traffic with bodies
npm run dev -- start -h api.example.com --log-body --chat-mode=false

# Debug mode for troubleshooting
npm run dev -- start --debug --log-body --chat-mode=false

📸 What You'll See

In chat mode (default), the output is clean and focused:

🚀 Proxy server started on http://localhost:8000
📡 Forwarding to https://api.anthropic.com:443
📝 Logging all traffic to console...

👤 How do I read a file in Python?

🤖 To read a file in Python, you can use the built-in `open()` function. Here are the most common approaches:

### Basic File Reading

```python
# Read entire file content
with open('filename.txt', 'r') as file:
    content = file.read()
    print(content)

... (formatted markdown output) ...


## 🛠 Development

```bash
# Install dependencies
npm install

# Run in development mode
npm run dev -- start

# Build for production
npm run build

# Type checking
npm run typecheck

# Linting
npm run lint

📦 Installation Options

Option 1: Use without installation (Recommended)

npx claude-code-logger start

Option 2: Install globally

npm install -g claude-code-logger
claude-code-logger start

🤝 Contributing

Contributions are welcome! This tool is specifically designed for Claude Code, but can be extended for other use cases.

📄 License

MIT


Note: This tool is not affiliated with Anthropic. It's an independent project designed to help developers work more effectively with Claude Code.