Skip to content

Ensure Metadata is Properly Passed to LogReturn in Logging Class #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ export class Logs {
consoleLog(logMessage, metadata);
}

// Ensure metadata is set correctly in LogReturn
return new LogReturn(
{
raw: logMessage,
diff: this._diffColorCommentMessage(type, logMessage),
type,
level,
},
metadata
metadata // Ensure metadata is passed correctly here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metadata was already passed in here, you've just added a comment

);
}

Expand Down Expand Up @@ -183,6 +184,7 @@ export class Logs {
return -1;
}
}

static convertErrorsIntoObjects(obj: unknown): Metadata | unknown {
// this is a utility function to render native errors in the console, the database, and on GitHub.
if (obj instanceof Error) {
Expand All @@ -197,6 +199,7 @@ export class Logs {
obj[key] = this.convertErrorsIntoObjects(obj[key]);
});
}
return obj;

return obj;
}
}
Loading