Skip to content

Commit

Permalink
CLI: CLI isn't logging to file, log environment vars
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Dec 5, 2024
1 parent 9f38965 commit c3afd34
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cli/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { serverSchema } from '@/env/schema.mjs';
import { globalPinoOpts } from '@/helpers/logger.js';
import dotenv from 'dotenv';
import { existsSync, readFileSync } from 'fs';
import { echo } from 'zx';

let logger: pino.Logger | null = null;
const envFile = existsSync('./.env.local') ? readFileSync('.env.local') : readFileSync('.env');
Expand All @@ -11,6 +12,7 @@ export const getLogger = () => {
return logger;
}
const environment = serverSchema.parse({ NODE_ENV: 'production', ...dotenv.parse(envFile) });
echo('environment', environment);
const transportOption: pino.LoggerOptions['transport'] =
process.env.NODE_ENV === 'development'
? {
Expand Down

0 comments on commit c3afd34

Please sign in to comment.