Giter Site home page Giter Site logo

luisw19 / winston-remote Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miguelmota/winston-remote

0.0 1.0 0.0 14 KB

Stream your winston logs to a remote winston server

Home Page: https://github.com/miguelmota/winston-remote

License: MIT License

JavaScript 100.00%

winston-remote's Introduction

Winston Remote

Stream your winston logs to a remote winston server.

Install

Available via npm

npm install winston-remote

Usage

Set up your remote winston server:

var winston = require('winston');
var winstonRemote = require('winston-remote').Server;

var winstonServer = winstonRemote.createServer({
    port: 9003
});

winstonServer.listen();

// Set up the winston logger transports
winstonServer.logger = new (winston.Logger)({
    transports: [
        new winston.transports.File({ filename: '/var/log/winston/info.log' })
    ]
});
node server.js

Listening on port 9003

Set up your local winston transport that sends the winston logs to the remote server:

var winston = require('winston');
var winstonRemoteTransport = require('winston-remote').Transport;

var logger = new (winston.Logger)({
    transports: [
        new (winstonRemoteTransport)({
            host: '192.168.1.100', // Remote server ip
            port: 9003 // Remote server port
        })
    ]
});

Afterwards just log as usual:

logger.info('foo');

and then on your remote server you can check the save logged files:

cat /var/log/winston/info.log

{"level":"info","message":"foo","timestamp":"2014-05-12T02:56:23.039Z"}

With line info:

...
new (winstonRemoteTransport)({
    host: '127.0.0.1',
    port: 9003,
    label: 'Client',
    stack: true
})
...
info: Client::foo at example/log.js:16:8 Object.<anonymous>

License

Released under the MIT License.

winston-remote's People

Contributors

miguelmota avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.