npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

winston-warp10

v1.0.4

Published

Winston logger transport for Warp10

Downloads

3

Readme

ISC License Test Status

winston-warp10

A Warp10 transport for Winston.

Installation

  $ npm install winston
  $ npm install winston-warp10

Basic usage

var winston = require('winston');
var warp10 = require('winston-warp10').Warp10;
  
/* Check https://sandbox.senx.io to get your 
*  <writeToken> for using Warp10 sandbox.
*  Or use credentials from your own Warp10 instance
*/ 
var options = {
    writeToken: "<writeToken>",
    protocol: "https",    
    host: "sandbox.senx.io",
    className: "test"
}

winston.add(new warp10(options));
  
/* Insert a new entry in the GTS 'test{}' with value equals to 'logs' */
winston.info("logs");

The Warp10 transport takes the following options. writeToken, protocol, host and className are required :

  • level: Level of messages transport will log, default : info.
  • silent: Boolean flag indicating whether to suppress output, default : false.
  • name: Name and identifier of the transport instance, default : Warp10.
  • writeToken: Warp10 writing token.
  • protocol: http or https or ws or wss.
  • host: Host. Can be sandbox : "sandbox.senx.io" therefore you can only use https or wss protocol. Or it can be any host address of private Warp10 instance.
  • port: Port of your Warp10 instance. Empty for Warp10 sandbox.
  • className: Class name of the GTS you want to send your data to.
  • labels: Labels of the GTS, default : empty.
  • timestamp: Timestamp, default : use Warp10 own timestamp.
  • Latitude: Latitude coordinate.
  • Longitude: Longitude coordinate.
  • Elevation: Elevation above sea level.
  • KeepWSAlive: Keep alive websocket connection, default true. Useless in http or https protocol.

Advanced usage

In the example below, we create our own winston logger. We add the warp10 transport, then we will be able to dynamically set attributes like latitude or labels even after the creation of the transport.

const winston = require('winston');
const warp10Transport = require('winston-warp10').Warp10;

const customLogger = winston.createLogger({
    /* options 
    *  You can set various options for your own custom
    *  logger, see Winston documentation.
    */
    transports: [
        new warp10Transport({
            name: "My Warp10 transport",
            writeToken: "<writeToken>",
            protocol: "https",
            host: "sandbox.senx.io",
            className: "test",
            labels: "position=Paris"
        }),
    ] 
})

/* Insert a new entry in the GTS 'test' with label 'position=Paris' and value equals to 'Hello from Paris', at Eiffel Tower's geographic position */
customLogger.transports[0].latitude = "48.86";
customLogger.transports[0].longitude = "2.29"
customLogger.info("Hello from Paris");

Changelog

Current Version: 1.0.4 — Released 2019-08-27

  • Fix error.response undefined in post request

Version: 1.0.3 — Released 2019-08-22

  • Correctly escape special chars in string value

Version: 1.0.2 — Released 2019-07-31

  • Update axios.post error message

Version: 1.0.1 — Released 2019-07-15

  • Handle promise rejection warning

Version: 1.0.0 — Released 2019-07-03

  • Introducing the warp10 Transport for winston.

License

winston-warp10 is freely distributable under the terms of the ISC license.

Author: Pierre-Antoine Moitier

Contributors: Erwan Géréec