mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
fix early return in jsonl path for log level
This commit is contained in:
parent
319620a414
commit
b75cc0e372
1 changed files with 2 additions and 1 deletions
|
|
@ -57,10 +57,11 @@ const pair = (key: string, value: LogiValue | undefined) => {
|
|||
|
||||
export const createLogiHandler = (conf: DittoConf, defaultHandler: LogiHandler) => (log: LogiLog) => {
|
||||
const { fmt, level, scopes } = conf.logConfig;
|
||||
if (fmt === 'jsonl') return defaultHandler(log);
|
||||
if (!isLevel(level)) throw new Error(`Invalid log level ${level} specified`);
|
||||
if (!lowerLevels[level].includes(log.level)) return;
|
||||
if (scopes.length && !scopes.some((scope) => scope.startsWith(log.ns))) return;
|
||||
if (fmt === 'jsonl') return defaultHandler(log);
|
||||
|
||||
const message = prettyPrint(log.message || log.msg || '');
|
||||
const remaining = Object.entries(log)
|
||||
.filter(([key]) => !['ns', 'level', 'message', 'msg'].includes(key));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue