this should fix the issue with wrongline detection support
All checks were successful
Code quality checks / biome (push) Successful in 7s

This commit is contained in:
creations 2025-05-25 11:57:39 -04:00
parent 2c4f3cf5de
commit 5c88ce3e28
Signed by: creations
GPG key ID: 8F553AA4320FC711
2 changed files with 12 additions and 19 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "@atums/echo", "name": "@atums/echo",
"version": "1.0.2", "version": "1.0.3",
"description": "A minimal, flexible logger", "description": "A minimal, flexible logger",
"private": false, "private": false,
"type": "module", "type": "module",

View file

@ -40,7 +40,6 @@ function getCallerInfo(config: Required<LoggerConfig>): {
prettyTimestamp: string; prettyTimestamp: string;
} { } {
const id = generateShortId(); const id = generateShortId();
const timestampInfo = getTimestamp(config); const timestampInfo = getTimestamp(config);
const fallback = { const fallback = {
id, id,
@ -52,9 +51,7 @@ function getCallerInfo(config: Required<LoggerConfig>): {
}; };
const stack = new Error().stack; const stack = new Error().stack;
if (!stack) { if (!stack) return fallback;
return fallback;
}
const lines = stack.split("\n"); const lines = stack.split("\n");
@ -65,12 +62,14 @@ function getCallerInfo(config: Required<LoggerConfig>): {
/at\s+(?:.*\()?file:\/\/(.*):(\d+):(\d+)\)?/, /at\s+(?:.*\()?file:\/\/(.*):(\d+):(\d+)\)?/,
); );
if (fileURLMatch) { if (fileURLMatch) {
const fullPath = fileURLMatch[1]; const [_, fullPath, lineNumber, columnNumber] = fileURLMatch;
const lineNumber = fileURLMatch[2]; const isInternal =
const columnNumber = fileURLMatch[3]; fullPath.includes("atums.echo") || fullPath.includes("@atums/echo");
if (isInternal) continue;
return { return {
id: id, id,
fileName: basename(fullPath), fileName: basename(fullPath),
line: lineNumber, line: lineNumber,
column: columnNumber, column: columnNumber,
@ -81,17 +80,11 @@ function getCallerInfo(config: Required<LoggerConfig>): {
const rawMatch = line.match(/at\s+(?:.*\()?(.+):(\d+):(\d+)\)?/); const rawMatch = line.match(/at\s+(?:.*\()?(.+):(\d+):(\d+)\)?/);
if (rawMatch) { if (rawMatch) {
const fullPath = rawMatch[1]; const [_, fullPath, lineNumber, columnNumber] = rawMatch;
const lineNumber = rawMatch[2]; const isInternal =
const columnNumber = rawMatch[3]; fullPath.includes("atums.echo") || fullPath.includes("@atums/echo");
if ( if (isInternal) continue;
fullPath.includes("/logger/") ||
fullPath.includes("/src/index.ts") ||
fullPath.includes("/src/lib/")
) {
continue;
}
return { return {
id: id, id: id,