You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce a user-configurable logging abstraction for ArkEnv — log levels, silent mode, and custom logger injection — unifying the currently separate logging surfaces across build integrations, CLI, and runtime packages.
Follows:#1237 (Phase 1 — finish @arkenv/build/log migration on v1)
Problem
After Phase 1 (#1237) and PR #1294, ArkEnv will have consistent prefix formatting, but logging remains fragmented:
There is no way for consumers to suppress warnings, redirect output, or provide a custom logger across integrations. Each surface was designed independently.
Desired behavior
A shared, injectable logger API that:
Lets consumers provide a custom logger instance or configure log level / silent mode
Works across Node, Bun, and browser-compatible packages (no Node-only assumptions in shared code)
Keeps thrown validation errors (ArkEnvError) separate from logged warnings/errors
Subsumes or bridges the existing @arkenv/buildLogger type and @arkenv/build/log static helpers without breaking Phase 1 output format
Does not require CLI-specific features (spinners, JSON reporters) in the shared interface — CLI LoggerPort may adapt the shared type
Open design questions
Package placement: New internal package (e.g. @arkenv/log or @repo/log), module inside @arkenv/internal/utils, or extension of @arkenv/build/log?
API surface: Which methods? (error, warn, info, debug?) Support silent mode, env-driven log levels (ARKENV_LOG_LEVEL?), user-provided instances?
Runtime constraints: How do browser-compatible packages avoid Node-only behavior (e.g. process.exit in Next.js config on validation failure)?
Relationship to CLI: Should LoggerPort implement/extend the shared interface, or remain a CLI-only adapter that wraps it?
Relationship to ArkEnvError: Keep formatting in the throw path, or allow the logger to control output style for validation failures?
Shared logger interface defined and published (or internal-only, with clear export path)
Build integrations (@arkenv/build, @arkenv/nextjs, @arkenv/nuxt, @arkenv/bun-plugin, @arkenv/vite-plugin) accept an optional logger and fall back to sensible defaults
Silent / log-level configuration supported (env var and/or programmatic)
CLI LoggerPort integrates with the shared interface without losing JSON/quiet/spinner behavior
ArkEnvError throw behavior unchanged unless explicitly redesigned and documented
Browser-compatible packages do not introduce Node-only APIs in the shared logger
Summary
Introduce a user-configurable logging abstraction for ArkEnv — log levels, silent mode, and custom logger injection — unifying the currently separate logging surfaces across build integrations, CLI, and runtime packages.
Follows: #1237 (Phase 1 — finish
@arkenv/build/logmigration onv1)Problem
After Phase 1 (#1237) and PR #1294, ArkEnv will have consistent prefix formatting, but logging remains fragmented:
@arkenv/build/log— static helpers that callconsole.*directly (logBuildWarning,logBuildError, etc.)@arkenv/buildLoggertype — minimal optional{ error, info? }passed to watcher callbacksLoggerPort— rich CLI-specific interface (spinners, JSON mode,--quiet,fatal,flush)ArkEnvError— thrown validation errors with styled formatting (separate from logging; done in (v1) Unify error normalization and formatting #1157)There is no way for consumers to suppress warnings, redirect output, or provide a custom logger across integrations. Each surface was designed independently.
Desired behavior
A shared, injectable logger API that:
ArkEnvError) separate from logged warnings/errors@arkenv/buildLoggertype and@arkenv/build/logstatic helpers without breaking Phase 1 output formatLoggerPortmay adapt the shared typeOpen design questions
@arkenv/logor@repo/log), module inside@arkenv/internal/utils, or extension of@arkenv/build/log?error,warn,info,debug?) Support silent mode, env-driven log levels (ARKENV_LOG_LEVEL?), user-provided instances?process.exitin Next.js config on validation failure)?LoggerPortimplement/extend the shared interface, or remain a CLI-only adapter that wraps it?ArkEnvError: Keep formatting in the throw path, or allow the logger to control output style for validation failures?Prerequisites
v1— all ad-hocconsole.*call sites migrated to@arkenv/build/logorLoggerPortAcceptance criteria
@arkenv/build,@arkenv/nextjs,@arkenv/nuxt,@arkenv/bun-plugin,@arkenv/vite-plugin) accept an optional logger and fall back to sensible defaultsLoggerPortintegrates with the shared interface without losing JSON/quiet/spinner behaviorArkEnvErrorthrow behavior unchanged unless explicitly redesigned and documentedOut of scope
EnvIssue,formatIssues,safeArkEnv) — done in (v1) Unify error normalization and formatting #1157dev) feature work — this ships with the v1 breaking releaseTarget branch
v1— v1 is the upcoming breaking release; new cross-cutting APIs belong here, not ondev(v0 maintenance).Related
@arkenv/build/log