Packages
snakepit
0.7.4
0.13.0
0.12.0
0.11.1
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.11
0.6.10
0.6.9
0.6.8
0.6.7
0.6.6
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.2
0.1.1
0.1.0
High-performance pooler and session manager for external language integrations. Supports Python, Node.js, Ruby, and more with gRPC streaming, session management, and production-ready process cleanup.
Current section
Files
Jump to
Current section
Files
LOG_LEVEL_CONFIGURATION.md
# Snakepit Log Level Configuration
Snakepit provides fine-grained control over its internal logging to keep your application output clean.
## Quick Start
```elixir
# In your config/config.exs or application code
config :snakepit, log_level: :warning # Only show warnings and errors
```
## Available Log Levels
| Level | Description | When to Use |
|-------|-------------|-------------|
| `:debug` | Show all logs including detailed diagnostics | Development, troubleshooting |
| `:info` | Show informational messages (default) | Development |
| `:warning` | Only show warnings and errors | Production, demos, clean output |
| `:error` | Only show errors | Production (minimal logging) |
| `:none` | Suppress all Snakepit logs | When you want complete silence |
## Configuration Examples
### In Configuration Files
```elixir
# config/config.exs
config :snakepit,
log_level: :warning, # Suppress info and debug logs
pooling_enabled: true,
pool_config: %{pool_size: 4}
```
### In Scripts (Mix.install)
```elixir
# examples/my_script.exs
Application.put_env(:snakepit, :log_level, :warning)
Application.put_env(:snakepit, :pooling_enabled, true)
Mix.install([{:snakepit, path: "."}])
# Your code here - no Snakepit info logs!
Snakepit.execute("ping", %{})
```
### Runtime Configuration
```elixir
# Change log level at runtime
Application.put_env(:snakepit, :log_level, :debug) # Enable debug logs
Application.put_env(:snakepit, :log_level, :none) # Silence everything
```
## What Gets Suppressed?
When you set `log_level: :warning`, Snakepit will suppress:
- ✅ Pool initialization messages
- ✅ Worker startup notifications
- ✅ Process registration logs
- ✅ Thread limit configuration
- ✅ Session creation logs
- ✅ Tool registration messages
- ✅ Debug diagnostics
- ❌ Warnings (still shown)
- ❌ Errors (still shown)
## Use Cases
### Production Deployment
```elixir
config :snakepit, log_level: :warning
```
Keep logs clean while still seeing important warnings and errors.
### Development
```elixir
config :snakepit, log_level: :info
```
See what Snakepit is doing without overwhelming detail.
### Debugging Issues
```elixir
config :snakepit, log_level: :debug
```
See everything for troubleshooting.
### Demos and Examples
```elixir
config :snakepit, log_level: :none
```
Complete silence - only your application output.
## Note
This only affects **Snakepit's internal logs**. It does not affect:
- Your application's logs
- Elixir's Logger configuration
- Python worker output (configure separately with `PYTHONUNBUFFERED`)
## Redaction helpers
- Use the logger redaction helper when logging payloads you cannot drop entirely. It summarises maps/lists by shape, truncates long keys, and reports binary lengths instead of contents.
- The bridge and session store already call into the helper for tool parameters and metadata, protecting API keys and large blobs from leaking into log files (`test/unit/logger/redaction_test.exs`).
- Feel free to reuse the helper in downstream adapters for consistent masking semantics.
## Example Output Comparison
### Before (`:info` level):
```
[info] 🧵 Set Python thread limits...
[info] 🚀 Starting Snakepit with pooling enabled (size: 2)
[debug] Created worker capacity ETS table...
[info] Reserved worker slot default_worker_1...
[info] ✅ Worker 1/2 ready: default_worker_1
...
Ping result: %{"message" => "pong"}
```
### After (`:warning` level):
```
Ping result: %{"message" => "pong"}
```
Much cleaner!