diff --git a/package.json b/package.json index 7afed7c..0238cd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@atums/echo", - "version": "1.0.3", + "version": "1.0.2", "description": "A minimal, flexible logger", "private": false, "type": "module", diff --git a/src/lib/char.ts b/src/lib/char.ts index 00671eb..ae29015 100644 --- a/src/lib/char.ts +++ b/src/lib/char.ts @@ -40,6 +40,7 @@ function getCallerInfo(config: Required): { prettyTimestamp: string; } { const id = generateShortId(); + const timestampInfo = getTimestamp(config); const fallback = { id, @@ -51,7 +52,9 @@ function getCallerInfo(config: Required): { }; const stack = new Error().stack; - if (!stack) return fallback; + if (!stack) { + return fallback; + } const lines = stack.split("\n"); @@ -62,14 +65,12 @@ function getCallerInfo(config: Required): { /at\s+(?:.*\()?file:\/\/(.*):(\d+):(\d+)\)?/, ); if (fileURLMatch) { - const [_, fullPath, lineNumber, columnNumber] = fileURLMatch; - const isInternal = - fullPath.includes("atums.echo") || fullPath.includes("@atums/echo"); - - if (isInternal) continue; + const fullPath = fileURLMatch[1]; + const lineNumber = fileURLMatch[2]; + const columnNumber = fileURLMatch[3]; return { - id, + id: id, fileName: basename(fullPath), line: lineNumber, column: columnNumber, @@ -80,11 +81,17 @@ function getCallerInfo(config: Required): { const rawMatch = line.match(/at\s+(?:.*\()?(.+):(\d+):(\d+)\)?/); if (rawMatch) { - const [_, fullPath, lineNumber, columnNumber] = rawMatch; - const isInternal = - fullPath.includes("atums.echo") || fullPath.includes("@atums/echo"); + const fullPath = rawMatch[1]; + const lineNumber = rawMatch[2]; + const columnNumber = rawMatch[3]; - if (isInternal) continue; + if ( + fullPath.includes("/logger/") || + fullPath.includes("/src/index.ts") || + fullPath.includes("/src/lib/") + ) { + continue; + } return { id: id,