artzlogger
v0.0.12
Published
A cool logging process
Downloads
5
Maintainers
Readme
artzlogger
A simple custom logging modlie
Custom timestamp driver
const artzlogger = require('artzlogger');
const logger = new artzlogger({
timestamp: () => {return Date.now()}
})
Using moment for timestamp driver
const moment = require('moment');
const artzlogger = require('artzlogger');
const logger = new artzlogger({
timestamp: () => {return moment().format('DD/MM/YYYY HH:mm:ss')}
});
Custom streamable log driver
const moment = require('moment');
const artzlogger = require('artzlogger');
const logger = new artzlogger({
streamLog: {
enabled: true,
encode: 'JSON', // There's TXT too but if encode isn't set it will be TXT by default,
path: './logs/' // Optional! Just if you want different path for the logs to be written inn
}
});
Advanced Config
Capitalized log method name
const artzlogger = require('artzlogger');
const logger = new artzlogger({
capitalized: true
});
logger.error('Error!!!') // -> ERROR: Error!!!
Method Name Decorators
const artzlogger = require('artzlogger');
const logger = new artzlogger({
decorators: {
start: "⚠️",
end: "⚠️"
}
});
logger.error('Error!!!') // -> ⚠️error⚠️: Error!!!
Escaped Output
const artzlogger = require('artzlogger');
const logger = new artzlogger({
escapedOutput: true,
});
logger.error({s: "s"} + ' ' + 'Has failed') // -> error: [Object: object] Has failed