Small JS utility to create colored logs for both terminal and browser console
yarn add @deverlabs/tiny-logger
npm install @deverlabs/tiny-logger
import { Logger } from '@deverlabs/tiny-logger';
const logger = new Logger('/api/user')
logger.info('User successfuly connected:', { id: 2 })
[10:25:26.574] INFO [/api/user]: User successfuly connected: { id: 2 }
import { Logger } from '@deverlabs/tiny-logger';
const logger = new Logger('/api/user')
logger.start()
...
logger.stop()
[14:35:43.945] TIME [/api/user]: Start timer [14:35:43.945]
[14:35:43.949] TIME [/api/user]: Duration +4ms
Instanciate a new TinyLogger object with label
to identify the current file for easier debugging
Print informative message
Print error message
Print success message
Print warning message
Print debug message
ℹ️ This will works only when proces.env.NODE_ENV is set to
development
Start a timer to measure execution time in your code
Stop the timer and output the time elapsed in milliseconds