Skip to content

feat(workflow-executor): configurable log level via LOG_LEVEL env (PRD-407)#1624

Open
nbouliol wants to merge 1 commit into
feat/prd-214-server-step-mapperfrom
feat/prd-407-executor-log-level
Open

feat(workflow-executor): configurable log level via LOG_LEVEL env (PRD-407)#1624
nbouliol wants to merge 1 commit into
feat/prd-214-server-step-mapperfrom
feat/prd-407-executor-log-level

Conversation

@nbouliol
Copy link
Copy Markdown
Member

@nbouliol nbouliol commented Jun 3, 2026

Summary

  • Align Logger shape with @forestadmin/agent convention: function signature (level: LoggerLevel, message: string, context?: Record<string, unknown>) => void, capitalized LoggerLevel = 'Debug' | 'Info' | 'Warn' | 'Error'. Structured context object preserved (executor extension, agent only carries error?).
  • createConsoleLogger(minLevel) / createPrettyLogger(minLevel) factories filter at the source — calls below the threshold are dropped before any IO.
  • CLI reads LOG_LEVEL env var (validated via zod, throws ConfigurationError on invalid value). Default Info preserves current behavior. Library consumers pass loggerLevel on ExecutorOptions.
  • printHelp and example/.env.executors.example updated.

Test plan

  • Unit tests for level filtering on both adapters (console-logger.test.ts, pretty-logger.test.ts)
  • CLI tests cover TTY/--pretty/--json selection + level filtering through pickLogger
  • Full suite: 887/887 green
  • Lint clean, build clean
  • Manual: LOG_LEVEL=Warn node dist/cli.js --in-memory --pretty should drop Info lines

fixes PRD-407

🤖 Generated with Claude Code

Note

Add configurable log level to workflow-executor via LOG_LEVEL env variable

  • Replaces the object-based Logger interface (info/warn/error methods) with a callable function type (level, message, context?) => void with levels 'Debug' | 'Info' | 'Warn' | 'Error' in logger-port.ts.
  • Replaces class-based ConsoleLogger/PrettyLogger with factory functions createConsoleLogger(minLevel) and createPrettyLogger(minLevel) that filter messages below the configured minimum level.
  • Adds parseLoggerLevelEnv in cli-core.ts to parse and validate LOG_LEVEL, throwing a ConfigurationError on invalid values; defaults to 'Info'.
  • Propagates the resolved log level through ExecutorOptions.loggerLevel so all executor components share the same configured threshold.
  • Updates all call sites across executors, adapters, stores, and HTTP server to use the new function-style logger API.
  • Behavioral Change: logs below the configured LOG_LEVEL are now silently dropped; the default threshold is 'Info', so 'Debug' messages are suppressed by default.

Macroscope summarized 379d933.

…D-407]

Align Logger with @forestadmin/agent shape (function signature, capitalized
LoggerLevel) and add a minimum-level filter on the source. Default Info
preserves current behavior; CLI reads LOG_LEVEL, library consumers pass
loggerLevel in ExecutorOptions.

fixes PRD-407

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 3, 2026

PRD-407

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Jun 3, 2026

10 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 14): createWorkflowExecutor 6
qlty Structure Function with many returns (count = 5): execute 4

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Jun 3, 2026

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (16)

RatingFile% DiffUncovered Line #s
New Coverage rating: A
packages/workflow-executor/src/adapters/console-logger.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/runner.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/executors/step-executor-factory.ts100.0%
New Coverage rating: A
...ow-executor/src/executors/load-related-record-step-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/build-workflow-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/adapters/pretty-logger.ts100.0%
New Coverage rating: A
...-executor/src/adapters/forestadmin-client-activity-log-port.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/remote-tool-fetcher.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/executors/base-step-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/http/executor-http-server.ts100.0%
New Coverage rating: A
.../workflow-executor/src/adapters/forest-server-workflow-port.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/adapters/with-retry.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/executors/mcp-step-executor.ts50.0%178
New Coverage rating: A
packages/workflow-executor/src/defaults.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/stores/database-store.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/cli-core.ts75.0%45-53
Total95.0%
🤖 Increase coverage with AI coding...
In the `feat/prd-407-executor-log-level` branch, add test coverage for this new code:

- `packages/workflow-executor/src/cli-core.ts` -- Line 45-53
- `packages/workflow-executor/src/executors/mcp-step-executor.ts` -- Line 178

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant