0.2.2 • Published 3 years ago
pino-logger-client v0.2.2
pino-logger-client
Small logging library that also send logs to a configurable endpoint
Usage
- Install client using
npm install pino-logger-client --savefrom npm - Import with
import { Logger } from 'pino-logger-client' - Instantiate and configure the logger class with
const logger = new Logger(API_URL | false, LoggerName);,LoggerNameis the name that will appear in the logs, it's also optional. - if
API_URLisfalsenothing will be sent to API, this is preferable for local development. - Use its methods
logger.info|warn|error|success('message') - The logger also registers some global error listeners, which can be unregisterd with
logger.unregisterListeners()
Local development console helper
When process.env is not production then any log will appear in the browser console like this:
This is part of pino-h3-elastic-logger
TODO: Some things are not working properly.