Skip to content

Instantiating a Loggy instance

This instantiates a loggy logger and accepts a LoggyConfig interface. Once created you can call loggy in various formats to log messages of different levels.

const loggy = CreateLoggy({
level: "info", // debug, info, warn, or error
identifier: "my-app", // an identifier for your application or service
color: true, // enable colors
compact: false, // compact mode for json objects
timestamp: true // show the timestamp in the log message
});
loggy.log("This is a log message");
loggy.info("This is an info message");
loggy.warn("This is a warn message");
loggy.error("This is an error message");