Skip to content

Logging with Loggy

Loggy accepts a tags parameter after the log message you want to print that can include an object. This can be helpful when printing error messages and you need more information for debugging.

const user = {
user: {
id: 123,
name: 'John Doe',
details: {
age: 30,
address: {
city: 'New York',
zip: '10001'
}
}
}
}
const loggy = CreateLoggy({
level: "error",
identifier: "my-app",
});
loggy.log("This is a log message");
loggy.error("This is an error message with tags", user);

Will print the following to the console

Terminal window
7/14/2025 10:29:11 PM [LOG] my-app: This is a log message
7/14/2025 10:29:14 PM [ERROR] my-app: This message contains nested objects in the tags.
{
user: {
id: 123,
name: 'John Doe',
details: {
age: 30,
address: {
city: 'New York',
zip: '10001'
}
}
}
}