diff --git a/packages/conf/DittoConf.ts b/packages/conf/DittoConf.ts index d6559cca..05e7d19f 100644 --- a/packages/conf/DittoConf.ts +++ b/packages/conf/DittoConf.ts @@ -11,8 +11,6 @@ import { getEcdsaPublicKey } from './utils/crypto.ts'; import { optionalBooleanSchema, optionalNumberSchema } from './utils/schema.ts'; import { mergeURLPath } from './utils/url.ts'; -import { VALID_LOG_TYPES } from '../ditto/utils/logi.ts'; - /** Ditto application-wide configuration. */ export class DittoConf { constructor(private env: { get(key: string): string | undefined }) { @@ -257,12 +255,10 @@ export class DittoConf { level ||= 'debug'; scopes ||= ''; - if (fmt && !VALID_LOG_TYPES.includes(fmt)) { - throw new Error(`Invalid log type supplied: Valid types are [${VALID_LOG_TYPES.join('|')}].`); - } + if (fmt !== 'jsonl' && fmt !== 'pretty') fmt = 'jsonl'; return { - fmt: (fmt ?? 'jsonl') as 'jsonl' | 'pretty', + fmt: fmt as 'jsonl' | 'pretty', level, scopes: scopes.split(',').filter(Boolean), }; diff --git a/packages/ditto/utils/logi.ts b/packages/ditto/utils/logi.ts index 0d071254..4b764201 100644 --- a/packages/ditto/utils/logi.ts +++ b/packages/ditto/utils/logi.ts @@ -55,8 +55,6 @@ const pair = (key: string, value: LogiValue | undefined) => { return `${key}: ${prettyPrint(value || '')}`; }; -export const VALID_LOG_TYPES = ['jsonl', 'pretty']; - export const createLogiHandler = (conf: DittoConf, defaultHandler: LogiHandler) => (log: LogiLog) => { const { fmt, level, scopes } = conf.logConfig; if (fmt === 'jsonl') return defaultHandler(log);