Skip to content

Commit

Permalink
Merge pull request #1168 from jetstreamapp/chore/add-new-env-var-pret…
Browse files Browse the repository at this point in the history
…ty-logger

Add new flag specific for pretty-logging
  • Loading branch information
paustint authored Feb 8, 2025
2 parents 7757548 + 5e86de1 commit 1e18f4c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ NX_SFDC_API_VERSION='62.0'
# trace, debug (default), info, warn, error, fatal, silent
LOG_LEVEL='trace'

# If true, will print out logs in a more human readable format instead of JSON (only in dev mode)
PRETTY_LOGS='true'

# Default value for email two-factor authentication for new users
JETSTREAM_AUTH_2FA_EMAIL_DEFAULT_VALUE='false'
# Session signing secret - minimum of 32 characters
Expand Down
2 changes: 1 addition & 1 deletion libs/api-config/src/lib/api-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ENV } from './env-config';
export const logger = pino({
level: ENV.LOG_LEVEL,
transport:
ENV.ENVIRONMENT === 'development' && !ENV.IS_LOCAL_DOCKER && !ENV.CI
ENV.ENVIRONMENT === 'development' && ENV.PRETTY_LOGS && !ENV.IS_LOCAL_DOCKER
? {
target: 'pino-pretty',
}
Expand Down
1 change: 1 addition & 0 deletions libs/api-config/src/lib/env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const envSchema = z.object({
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'silent'])
.optional()
.transform((value) => value ?? 'debug'),
PRETTY_LOGS: booleanSchema,
CI: booleanSchema,
// LOCAL OVERRIDE
// EXAMPLE_USER: z.record(z.any()).optional(),
Expand Down

0 comments on commit 1e18f4c

Please sign in to comment.