jethro
v4.4.4
Published
Modular logging utility
Downloads
1,283
Readme
Jethro
Jethro Logger is an all-in-one logging utility designed to give developers the logging tools and flexibility they need within one complete package. It is also designed to be used in cooperation with other tools and transport services.
Compatible with Node >= 8.0
.
Deprecation Notice
While Jethro is still functional with node.js 8 onwards, development has halted and more active alternatives exist including Winston which has a similar philosophy and approach to it's API.
Installation
npm i jethro --save
Usage
var logger = require('jethro');
logger('info', 'Testing', 'This is a test message!');
Examples
Console
var Jethro = require('jethro');
var logger = new Jethro();
logger('info', 'Somewhere', 'Something happened...');
// OR
var logger = require('jethro');
logger.info('Somewhere', 'Something happened');
The API
var logger = new Jethro();
logger.log(severity, source, message);
logger.direct({
source,
severity,
message,
timestamp
});
logger.output({
source,
severity,
message,
timestamp
});
logger.info(source, message);
logger.transport(source, message);
logger.debug(source, message);
logger.success(source, message);
logger.warn(source, message);
logger.warning(source, message);
logger.error(source, message);
logger.fatal(source, message);
Plugins
Express
var Jethro = require('jethro');
var logger = new Jethro();
var expressLog = new Jethro.Express();
logger.addPlugin('express', expressLog);
app.use(expressLog.input());
// OR
var logger = require('jethro');
logger.addPlugin('express', new Jethro.Express());
app.use(logger.plugins.express.input());
Transports
File logging
var Jethro = require('jethro');
var path = require('path');
var logger = new Jethro();
var jethroFile = new Jethro.File();
jethroFile.setFilePath(path.join(__dirname, 'logs'));
logger.addTransport('file', jethroFile);
Projects using this logger
- TFL Bot (plug.dj)
Credits
Created and maintained by Sam Mills.
Helped and maintained with Alex.
Suggestions and moral support from xBytez and Matthew!
Special thanks to ReAnna whom without which, version 3+ would not be possible.
License
Licensed under the LGPL-v3 & MIT Licenses
Copyright (C) 2022 Sam Mills.