File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,8 +64,11 @@ export function loadBenchmarkConfig(installDir: string): BenchmarkConfig {
6464 if ( process . env . POSTHOG_WIZARD_BENCHMARK_FILE ) {
6565 config . output . benchmarkPath = process . env . POSTHOG_WIZARD_BENCHMARK_FILE ;
6666 }
67- if ( process . env . POSTHOG_WIZARD_LOG_FILE ) {
68- config . output . logPath = process . env . POSTHOG_WIZARD_LOG_FILE ;
67+ if ( process . env . POSTHOG_WIZARD_LOG_DIR ) {
68+ config . output . logPath = path . join (
69+ process . env . POSTHOG_WIZARD_LOG_DIR ,
70+ 'posthog-wizard.log' ,
71+ ) ;
6972 }
7073
7174 // If benchmark output is disabled, disable the jsonWriter plugin
@@ -83,8 +86,11 @@ export function loadBenchmarkConfig(installDir: string): BenchmarkConfig {
8386 if ( process . env . POSTHOG_WIZARD_BENCHMARK_FILE ) {
8487 config . output . benchmarkPath = process . env . POSTHOG_WIZARD_BENCHMARK_FILE ;
8588 }
86- if ( process . env . POSTHOG_WIZARD_LOG_FILE ) {
87- config . output . logPath = process . env . POSTHOG_WIZARD_LOG_FILE ;
89+ if ( process . env . POSTHOG_WIZARD_LOG_DIR ) {
90+ config . output . logPath = path . join (
91+ process . env . POSTHOG_WIZARD_LOG_DIR ,
92+ 'posthog-wizard.log' ,
93+ ) ;
8894 }
8995
9096 return config ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import { FRAMEWORK_REGISTRY } from './lib/registry';
1414import { analytics } from './utils/analytics' ;
1515import { runAgentWizard } from './lib/agent-runner' ;
1616import { EventEmitter } from 'events' ;
17- import { logToFile } from './utils/debug' ;
17+ import { logToFile , configureLogFileFromEnvironment } from './utils/debug' ;
1818import { wizardAbort } from './utils/wizard-abort' ;
1919import { readApiKeyFromEnv } from './utils/env-api-key' ;
2020
@@ -38,6 +38,9 @@ type Args = {
3838} ;
3939
4040export async function runWizard ( argv : Args , session ?: WizardSession ) {
41+ // Apply log file env overrides for all modes (CI, benchmark, and interactive).
42+ configureLogFileFromEnvironment ( ) ;
43+
4144 const finalArgs = {
4245 ...argv ,
4346 ...readEnvironment ( ) ,
Original file line number Diff line number Diff line change 11import { appendFileSync } from 'fs' ;
2+ import path from 'path' ;
23import { prepareMessage } from './logging' ;
34import { getUI } from '../ui' ;
45
@@ -22,6 +23,18 @@ export function configureLogFile(opts: {
2223 if ( opts . enabled !== undefined ) logEnabled = opts . enabled ;
2324}
2425
26+ /**
27+ * Configure log path from environment variables.
28+ *
29+ * Uses POSTHOG_WIZARD_LOG_DIR when set, joined with posthog-wizard.log.
30+ */
31+ export function configureLogFileFromEnvironment ( ) : void {
32+ const envLogDir = process . env . POSTHOG_WIZARD_LOG_DIR ;
33+ if ( envLogDir ) {
34+ configureLogFile ( { path : path . join ( envLogDir , 'posthog-wizard.log' ) } ) ;
35+ }
36+ }
37+
2538/**
2639 * Initialize the log file with a run header.
2740 * Call this at the start of each wizard run.
You can’t perform that action at this time.
0 commit comments