Skip to content

Commit

Permalink
Remove from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehinds committed Jan 24, 2025
1 parent bcecf37 commit b9853c4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 43 deletions.
5 changes: 1 addition & 4 deletions config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,4 @@ external_loggers:
# CODEGATE_ENABLE_SQLALCHEMY=true
# CODEGATE_ENABLE_UVICORN_ERROR=true
# CODEGATE_ENABLE_AIOSQLITE=true
# 2. CLI arguments:
# --enable-litellm # Enables LiteLLM logging
# --enable-sqlalchemy # Enables SQLAlchemy logging
# etc.

6 changes: 0 additions & 6 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ codegate generate-certs [OPTIONS]
- Case-insensitive
- Overrides configuration file and environment variables

- `--enable-litellm`: Enable LiteLLM logging
- Optional flag
- Default: false
- Enables logging for LiteLLM Proxy, Router, and core components
- Overrides configuration file and environment variables

## Error handling

The CLI provides user-friendly error messages for:
Expand Down
19 changes: 4 additions & 15 deletions docs/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@ CodeGate provides control over external loggers through configuration:

LiteLLM logging can be controlled through:

1. CLI flag:
```bash
codegate serve --enable-litellm
```

2. Environment variable:
1. Environment variable:
```bash
export CODEGATE_ENABLE_LITELLM=true
```

3. Configuration file:
2. Configuration file:
```yaml
external_loggers:
litellm: true # Enable/disable LiteLLM logging (includes LiteLLM Proxy, Router, and core)
Expand Down Expand Up @@ -120,21 +115,15 @@ except Exception as e:

The logging system can be configured through:

1. CLI arguments:

```bash
codegate serve --log-level DEBUG --log-format TEXT --enable-litellm # to enable LiteLLM debug
```

2. Environment variables:
1. Environment variables:

```bash
export CODEGATE_APP_LOG_LEVEL=DEBUG
export CODEGATE_LOG_FORMAT=TEXT
export CODEGATE_ENABLE_LITELLM=true
```

3. Configuration file:
2. Configuration file:

```yaml
log_level: DEBUG
Expand Down
10 changes: 0 additions & 10 deletions src/codegate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,6 @@ def show_prompts(prompts: Optional[Path]) -> None:
default=None,
help="Path to the vector SQLite database file (default: ./sqlite_data/vectordb.db)",
)
@click.option(
"--enable-litellm",
is_flag=True,
default=False,
help="Enable LiteLLM logging (includes LiteLLM Proxy, Router, and core)",
)
def serve(
port: Optional[int],
proxy_port: Optional[int],
Expand All @@ -273,7 +267,6 @@ def serve(
ca_key: Optional[str],
server_cert: Optional[str],
server_key: Optional[str],
enable_litellm: bool,
) -> None:
"""Start the codegate server."""
try:
Expand All @@ -288,8 +281,6 @@ def serve(
if ollama_url:
cli_provider_urls["ollama"] = ollama_url

# Create external loggers dictionary from CLI arguments
cli_external_loggers = {"litellm": enable_litellm}

# Load configuration with priority resolution
cfg = Config.load(
Expand All @@ -301,7 +292,6 @@ def serve(
cli_log_level=log_level,
cli_log_format=log_format,
cli_provider_urls=cli_provider_urls if cli_provider_urls else None,
cli_external_loggers=cli_external_loggers,
model_base_path=model_base_path,
embedding_model=embedding_model,
certs_dir=certs_dir,
Expand Down
8 changes: 0 additions & 8 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,20 +258,12 @@ def test_serve_custom_options(cli_runner):
"custom-server.crt",
"--server-key",
"custom-server.key",
"--enable-litellm",
],
)

# Check the command executed successfully
assert result.exit_code == 0

# Assert logging setup was called with the provided log level and format
mock_setup_logging.assert_called_once_with(
LogLevel.DEBUG,
LogFormat.TEXT,
{"litellm": True, "sqlalchemy": False, "uvicorn.error": False, "aiosqlite": False},
)

# Validate run_servers was called once
mock_run.assert_called_once()
# Retrieve the actual Config object passed to run_servers
Expand Down

0 comments on commit b9853c4

Please sign in to comment.