@rsksmart/rif-node-utils
v0.0.3
Published
RIF Node.js utils
Downloads
7
Readme
npm i @rsksmart/rif-node-utils
Features
- Logger
Usage
Logging:
// myLogger.ts
import { loggerFactory, Logger } from '@rsksmart/rif-node-utils'
import dotenv from 'dotenv'
dotenv.config()
const ENV = process.env.NODE_ENV || 'dev'
const FILE = process.env.LOG_FILE || './log/issuer-backend.log'
const ERROR_FILE = process.env.LOG_ERROR_FILE || './log/issuer-backend.error.log'
export default loggerFactory({
env: ENV,
infoFile: FILE,
errorFile: ERROR_FILE
})
// script.js
import myLogger from './myLogger'
const logger: Logger = myLogger('super-logger')
logger.info('Info message')
logger.error('Error message')