Compare commits

..

No commits in common. "main" and "v1.0.2" have entirely different histories.
main ... v1.0.2

2 changed files with 19 additions and 12 deletions

View file

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

View file

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