true-gamer-server-logger
v1.0.2
Published
It provides a logger that can capture an input and pipe it to some destination
Readme
How to install this package
npm install true-gamer-server-logger
How to use this package
const Builder = require('true-gamer-server-logger')
const logger = Builder.new()
// You can enable file logger and provide path directly
.withFileLogger('/path/to/folder')
// or provide whole configuration object
.withFileLogger({
outputDirectory: '/path/to/folder',
// Provide pattern with ${Date} mount point that will be replaced
filePattern: 'log-${Date}.txt'
})
// You can add your custom formatter
.withCustomFormatters([
// as a anonymouns function
(input, next) => next(input.replace(/[0-9]+/, '')),
// or class
new CustomFormatter()
])
// You can add you custom logger
.withConsoleLogger([
new CustomLogger()
])
.build()
// Then use it simply to pass the data
logger.log("data")