Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston-logzio

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-logzio - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.travis.yml

10

lib/winston-logzio.js
var util = require('util');
var _ = require('lodash');
var _assign = require('lodash.assign');
var winston = require('winston');

@@ -41,3 +41,7 @@ var stringifySafe = require('json-stringify-safe');

_.assign(msg, {
if (meta instanceof Error) {
meta = {error: meta.stack || meta.toString()};
}
_assign(msg, {
level: level,

@@ -50,2 +54,2 @@ meta: meta

callback(null, true);
};
};
{
"name": "winston-logzio",
"description": "A winston transport wrapper for logzio",
"version": "1.0.1",
"version": "1.0.2",
"author": "Gilly Barr <gilly@logz.io>",

@@ -28,5 +28,5 @@ "contributors": [

"winston": "1.0.x",
"logzio-nodejs": "^0.3.6",
"logzio-nodejs": "0.4.1",
"json-stringify-safe": "5.0.x",
"lodash": "^3.10.1"
"lodash.assign": "4.2.0"
},

@@ -44,4 +44,4 @@ "devDependencies": {

"scripts": {
"test": "node_modules/.bin/mocha -w"
"test": "node_modules/.bin/mocha"
}
}

@@ -0,4 +1,12 @@

![Build Status](https://travis-ci.org/logzio/winston-logzio.svg?branch=master)
# winston-logzio
a winston transport wrapper for logzio
A Winston transport wrapper for [Logz.io](http://logz.io/)
## Installation
```js
npm install winston-logzio --save
```
## Sample usage

@@ -10,3 +18,3 @@ ```javascript

var loggerOptions = {
apiToken: '__YOUR_API_TOKEN__'
token: '__YOUR_API_TOKEN__'
};

@@ -19,6 +27,17 @@ winston.add(logzioWinstonTransport, loggerOptions);

Make sure you replace `__YOUR_API_TOKEN__` with your own logz.io api token.<br/>
If you do not have a [Logz.io](http://logz.io) account, you can sign up for a free trial [here](https://app.logz.io/#/signup)
## Details
This winston plugin, basically just wraps our [nodejs logzio shipper](https://github.com/logzio/logzio-nodejs).<br/>
If you want to configure the nodejs logger, any parameters sent to winston when initializing the transport
(what is held in the variable `loggerOptions` in the sample above) will be passed to the logzio nodejs logger itself.
(what is held in the variable `loggerOptions` in the sample above) will be passed to the logzio nodejs logger itself.
## Logs in my console
The winston logger by default sends all logs to the console.
You can easily disable this by adding this line to your code :
```js
winston.remove(winston.transports.Console);
```

@@ -24,13 +24,9 @@ var sinon = require('sinon');

it('builds the log object properly', function (done) {
var logzioTransport = new winston.transports.Logzio({
winston.add(winston.transports.Logzio, {
name: 'logger1',
token: '_API_TOKEN_'
token: '_API_TOKEN_'
});
//winston.add(winston.transports.Logzio, {
// name: 'logger1',
// token: '_API_TOKEN_'
//});
winston.loggers
var logMessage = 'Just a test message';
winston.log('warn', logMessage);
var errorMessage = 'Big problem';
winston.log('warn', logMessage, new Error(errorMessage));

@@ -41,2 +37,5 @@ assert(logSpy.calledOnce);

assert(loggedObject.level === 'warn');
assert(typeof loggedObject.meta === 'object');
assert(typeof loggedObject.meta.error === 'string');
assert(loggedObject.meta.error.indexOf(errorMessage) >= 0);

@@ -43,0 +42,0 @@ done();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc