pino-logger-client
v0.2.2
Published
Logger client that sends logs to an H3 powered API (and to ElasticSearch) and console in development mode. This is part of [pino-h3-elastic-logger](https://github.com/ArthurianX/pino-h3-elastic-logger)}
Downloads
23
Readme
pino-logger-client
Small logging library that also send logs to a configurable endpoint
Usage
- Install client using
npm install pino-logger-client --save
from npm - Import with
import { Logger } from 'pino-logger-client'
- Instantiate and configure the logger class with
const logger = new Logger(API_URL | false, LoggerName);
,LoggerName
is the name that will appear in the logs, it's also optional. - if
API_URL
isfalse
nothing 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.