From 8f51a9d6d7937a02134c0b03bee1fe93ebfd67bb Mon Sep 17 00:00:00 2001 From: Siddharth Singh Date: Sun, 6 Apr 2025 15:46:24 +0530 Subject: [PATCH] only show extra params when they are actually present --- packages/conf/DittoConf.ts | 7 +++++++ packages/ditto/utils/logi.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/conf/DittoConf.ts b/packages/conf/DittoConf.ts index 6a199ae9..6c06714c 100644 --- a/packages/conf/DittoConf.ts +++ b/packages/conf/DittoConf.ts @@ -238,6 +238,13 @@ export class DittoConf { }; } + /** + * The logging configuration for the Ditto server. The config is derived from + * the DEBUG environment variable and it is parsed as follows: + * + * `DEBUG='::comma-separated scopes to show'`. + * If the scopes are empty (e.g. in 'pretty:warn:', then all scopes are shown.) + */ get logConfig(): { fmt: 'jsonl' | 'pretty'; level: string; diff --git a/packages/ditto/utils/logi.ts b/packages/ditto/utils/logi.ts index f977da3b..f2db4256 100644 --- a/packages/ditto/utils/logi.ts +++ b/packages/ditto/utils/logi.ts @@ -72,6 +72,6 @@ export const createLogiHandler = (conf: DittoConf, defaultHandler: LogiHandler) 'color: unset', ); - console.log(remaining.map((itm) => pair(...itm)).join('\n')); + if (remaining.length) console.log(remaining.map((itm) => pair(...itm)).join('\n')); console.groupEnd(); };