From 8190017def691c739096fddad91c8a7b678212a5 Mon Sep 17 00:00:00 2001 From: Eugene Terehov Date: Sat, 8 Jun 2024 14:54:02 +0300 Subject: [PATCH] Format source --- docs/README.md | 2 +- src/BaseLogger.ts | 14 +++++++------- src/runtime/browser/index.ts | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/README.md b/docs/README.md index 3949d1f..8630092 100644 --- a/docs/README.md +++ b/docs/README.md @@ -686,7 +686,7 @@ For `pretty` logs: For `JSON` logs (no formatting happens here): ```typescript const logger = new Logger({ - type: "pretty", + type: "json", overwrite: { transportJSON: (logObjWithMeta: any) => { // transport the LogObj to console, StdOut, a file or an external service diff --git a/src/BaseLogger.ts b/src/BaseLogger.ts index 65673a0..c5cc026 100644 --- a/src/BaseLogger.ts +++ b/src/BaseLogger.ts @@ -213,13 +213,13 @@ export class BaseLogger { return Object.getOwnPropertyNames(source).reduce((o, prop) => { o[prop] = keys.includes(this.settings?.maskValuesOfKeysCaseInsensitive !== true ? prop : prop.toLowerCase()) ? this.settings.maskPlaceholder - : (()=>{ - try{ - return this._recursiveCloneAndMaskValuesOfKeys((source as Record)[prop], keys, seen); - }catch(e){ - return null; - } - })(); + : (() => { + try { + return this._recursiveCloneAndMaskValuesOfKeys((source as Record)[prop], keys, seen); + } catch (e) { + return null; + } + })(); return o; }, baseObject) as T; } else { diff --git a/src/runtime/browser/index.ts b/src/runtime/browser/index.ts index 36acb0c..d1e58d8 100644 --- a/src/runtime/browser/index.ts +++ b/src/runtime/browser/index.ts @@ -62,8 +62,7 @@ export function getCallerStackFrame(stackDepthLevel: number, error: Error = Erro } export function getErrorTrace(error: Error): IStackFrame[] { - return ((error as Error)?.stack - ?.split("\n") ?? []) + return ((error as Error)?.stack?.split("\n") ?? []) ?.filter((line: string) => !line.includes("Error: ")) ?.reduce((result: IStackFrame[], line: string) => { result.push(stackLineToStackFrame(line));