logger - console

Utility class to log information

Anacleto saves the logs of your scripts in rotating files using the json format.

The logging functionality can be accessed using both the console and logger classes. Both features give access to the methods log, info, warn, error all these methods allow you to pass a variable number of attributes and they will arrange themselves to create a properly formatted log.

Use logger on console as you prefer

Don't concatenate strings in the log, let logger do its job!

Example

const resp = {success: true, data : [1,2,3]}
logger.info(`Resp`, resp);

console result

Resp {success:true,data:[1,2,3]}

log

Log a message

Syntax

console.log(msg)

info

Log a info level message

Syntax

console.info(msg,[data..])

warn

Log a warn level message

Syntax

console.warn(msg,[data..])

error

Log a error level message

Syntax

console.error(msg,[data..])

Last updated