winston-logzio
Advanced tools
Comparing version 1.0.1 to 1.0.2
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(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4970
6
76
42
+ Addedlodash.assign@4.2.0
+ Addedasynckit@0.4.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbl@1.1.2(transitive)
+ Addedform-data@2.0.0(transitive)
+ Addedlodash.assign@4.2.0(transitive)
+ Addedlogzio-nodejs@0.4.1(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedqs@6.2.4(transitive)
+ Addedrequest@2.75.0(transitive)
+ Addedtough-cookie@2.3.4(transitive)
- Removedlodash@^3.10.1
- Removedasync@2.6.4(transitive)
- Removedbl@1.0.3(transitive)
- Removedform-data@1.0.1(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlogzio-nodejs@0.3.10(transitive)
- Removedqs@6.0.4(transitive)
- Removedrequest@2.68.0(transitive)
- Removedtough-cookie@2.2.2(transitive)
Updatedlogzio-nodejs@0.4.1