This package has been deprecated

    Author message:

    this tool is no longer being developed

    @namics/remlog-transports

    0.3.2 • Public • Published

    @namics/remlog-transports

    Transports are the way where your logs will be stored, for example temporary in the console, in a logfile or on a database etc. There are currently 2 transports supported:

    Contents
    const { FileSystem, Console, MongoDB } = require('@namics/remlog-transports');
    • Console (@namics/remlog-transports/Console)
    • FileSystem (@namics/remlog-transports/FileSystem)

    You can simply add the transports to your server by the constructor or CLI argument:

    new require('@namics/remlog-server').Server({
        transport: `@namics/remlog-transports/FileSystem`,
    });
    remlog server -t @namics/remlog-transports/Console

    Creating a new transport

    const { Transport } = require('@namics/remlog-transports');
    const connection = require('mysql').createConnection({
        host: 'localhost',
        user: 'me',
        password: 'secret',
        database: 'my_db',
    });
     
    class CustomTransport extends Transport {
        /**
         * This method will be responsible for the trace of logs
         *
         * @param {Object} payload          The log payload
         * @param {Function} resolve        Will resolve the trace and save it to the internal file
         */
        trace(payload, resolve) {
            connection.connect();
            connection.query('INSERT INTO LOGS ...');
            connection.end();
     
            resolve();
        }
    }

    Review the Changelog

    Install

    npm i @namics/remlog-transports

    DownloadsWeekly Downloads

    1

    Version

    0.3.2

    License

    MIT

    Unpacked Size

    19.5 kB

    Total Files

    15

    Last publish

    Collaborators

    • namicsorg
    • ernscht
    • tamara027
    • zidizei
    • danielkochde
    • tsailer
    • dienele