Jethro, the all in one intelligent and flexible logging and data transport system!
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
lib
test
.codeclimate.yml
.eslintignore
.eslintrc.json
.gitignore
.travis.yml
LGPLv3-license.txt
MIT-license.txt
README.md
appveyor.yml
jsdoc.json
package-lock.json
package.json
yarn.lock

README.md

Jethro Build Status npm version npm downloads Code Climate

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.

Installation

npm i jethro --save

Documentation

JSDoc documentation can be found here

Usage

var logger = require('jethro');

logger('info', 'Testing', 'This is a test message!');

It's as simple as that!

The simple makeup of the logger input is explained within the sections below:

logger( severity, source, message)

Here's a screenshot of a potential output:

Screenshot

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);

Settings & Customisations

Other Features

  • Namespaces
  • Error handling

Projects using this logger

  • HenchBot
  • HenchSpace backend infrastructure
  • TFL Bot (plug.dj)

Deprecated Documentation

Credits

Created and maintained Henchman.

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) 2016 Samuel Mills (known as Henchman, under the github teams: JethroLogger & HenchSpace)

Licenses: LGPL-v3 AND MIT