jethro

    4.4.3 • Public • Published

    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.

    Compatible with Node >= 8.0.

    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

    Install

    npm i jethro

    DownloadsWeekly Downloads

    43

    Version

    4.4.3

    License

    LGPL-3.0 AND MIT

    Unpacked Size

    220 kB

    Total Files

    14

    Last publish

    Collaborators

    • henchman
    • thedark1337
    • xbytez