Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cleanup-unused-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/sandbox': patch
---

Remove unused logging infrastructure (getLogger, runWithLogger) that was never called
19 changes: 16 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,22 @@ shared package for consistency across the SDK.

### Logging

- Centralized logger from `@repo/shared`
- Structured logging with component context
- Configurable via `SANDBOX_LOG_LEVEL` and `SANDBOX_LOG_FORMAT` env vars
**Pattern**: Explicit logger passing via constructor injection throughout the codebase.

```typescript
class MyService {
constructor(private logger: Logger) {}

async doWork() {
const childLogger = this.logger.child({ operation: 'work' });
childLogger.info('Working', { context });
}
}
```

**Configuration**: `SANDBOX_LOG_LEVEL` (debug|info|warn|error) and `SANDBOX_LOG_FORMAT` (json|pretty) env vars, read at startup.

**Testing**: Use `createNoOpLogger()` from `@repo/shared` in tests.

### Session Management

Expand Down
37 changes: 15 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions packages/sandbox-container/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/**
* Log level for the sandbox container.
*
* Default: info
* Environment variable: SANDBOX_LOG_LEVEL
*/
const SANDBOX_LOG_LEVEL = process.env.SANDBOX_LOG_LEVEL || 'info';

/**
* Log format for the sandbox container.
*
* Default: json
* Set to "pretty" to enable colored, human-readable output.
* Environment variable: SANDBOX_LOG_FORMAT
*/
const SANDBOX_LOG_FORMAT = process.env.SANDBOX_LOG_FORMAT || 'json';

/**
* How long to wait for an interpreter process to spawn and become ready.
* If an interpreter doesn't start within this time, something is fundamentally
Expand Down Expand Up @@ -82,8 +65,6 @@ const STREAM_CHUNK_DELAY_MS = 100;
const DEFAULT_CWD = '/workspace';

export const CONFIG = {
SANDBOX_LOG_LEVEL,
SANDBOX_LOG_FORMAT,
INTERPRETER_SPAWN_TIMEOUT_MS,
INTERPRETER_EXECUTION_TIMEOUT_MS,
COMMAND_TIMEOUT_MS,
Expand Down
Loading
Loading