Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped dependency of moment from 2.10.2 to 2.17.1 to fix DoS ... #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 84 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Whistlepunk

[![Version npm](https://img.shields.io/npm/v/whistlepunk.svg?style=flat)](https://www.npmjs.com/package/whistlepunk)
[![npm Downloads](https://img.shields.io/npm/dm/whistlepunk.svg?style=flat)](https://www.npmjs.com/package/whistlepunk)
[![Dependencies](https://img.shields.io/david/LeanKit-Labs/whistlepunk.svg?style=flat)](https://david-dm.org/LeanKit-Labs/whistlepunk)
[![Version npm](https://img.shields.io/npm/v/payapi-whistlepunk.svg?style=flat)](https://www.npmjs.com/package/payapi-whistlepunk)
[![npm Downloads](https://img.shields.io/npm/dm/payapi-whistlepunk.svg?style=flat)](https://www.npmjs.com/package/payapi-whistlepunk)
[![Dependencies](https://david-dm.org/payapi/whistlepunk/status.svg?style=flat)](https://david-dm.org/payapi/whistlepunk)

> *noun* - a lumberjack who operates the signal wire running to a donkey engine whistle.

## NOTE

This repository is a fork of https://github.com/LeanKit-Labs/whistlepunk. It was forked solely to apply dependency upgrades and to release an npm module containing the upgraded dependencies.

## What Is It?
Logging.....sigh. It's necessary, but often intrusive, heavy-handed and cumbersome...or it's anemic and fails to satisfy the needs of Ops and Developers. Whistlepunk doesn't care about what logging tools you love to use. It just cares that it needs to "blow the whistle" (i.e. - indicate something should be logged). You can plug your favorite logging tool into whistlepunk by writing an adapter for it (which consists of susbcribing to the postal "log" channel and writing the published log messages to your preferred logging library). At LeanKit, we're using [debug]() a lot (during development) and then standard out for production logs - so whistlepunk has two adapters (currently) built-in.

Expand All @@ -17,20 +21,20 @@ var postal = require("postal");
var whistlepunk = require("whistlepunk");

var config = {
adapters: {
stdOut: {
level: 4,
bailIfDebug: true, // disables stdOut if DEBUG=* is in play
timestamp: {
local: true, // defaults to UTC
format: "MMM-D-YYYY hh:mm:ss A" // ex: Jan 1, 2015 10:15:20 AM
},
topic: "#", // default topic
},
"debug": {
level: 4
}
}
adapters: {
stdOut: {
level: 4,
bailIfDebug: true, // disables stdOut if DEBUG=* is in play
timestamp: {
local: true, // defaults to UTC
format: "MMM-D-YYYY hh:mm:ss A" // ex: Jan 1, 2015 10:15:20 AM
},
topic: "#", // default topic
},
"debug": {
level: 4
}
}
};

var loggerFactory = whistlepunk(postal, config);
Expand All @@ -50,20 +54,20 @@ This also supports use cases where you may want to change log configuration duri
var whistlepunk = require("whistlepunk").log;

var config = {
adapters: {
stdOut: {
level: 5,
bailIfDebug: true, // disables stdOut if DEBUG=* is in play
timestamp: {
local: true, // defaults to UTC
format: "MMM-D-YYYY hh:mm:ss A" // ex: Jan 1, 2015 10:15:20 AM
},
topic: "#", // default topic
},
"debug": {
level: 5
}
}
adapters: {
stdOut: {
level: 5,
bailIfDebug: true, // disables stdOut if DEBUG=* is in play
timestamp: {
local: true, // defaults to UTC
format: "MMM-D-YYYY hh:mm:ss A" // ex: Jan 1, 2015 10:15:20 AM
},
topic: "#", // default topic
},
"debug": {
level: 5
}
}
};

var logger = whistlepunk( "my.topic" );
Expand Down Expand Up @@ -100,11 +104,11 @@ Be aware that when calling `reset` on a log, all adapter subscriptions that matc

__example topics__
```javascript
topic: "#" // will subscribe to all logs
topic: "autohost.#" // will subscribe to all autohost loggers
topic: "#.errors" // would subscribe to any logger with a namespace ending in "error"
topic: "myApp.#,autohost.#" // subscribes to `myApp.#` and `autohost.#`
topic: [ "myApp.#", "autohost.#" ] // same as above but
topic: "#" // will subscribe to all logs
topic: "autohost.#" // will subscribe to all autohost loggers
topic: "#.errors" // would subscribe to any logger with a namespace ending in "error"
topic: "myApp.#,autohost.#" // subscribes to `myApp.#` and `autohost.#`
topic: [ "myApp.#", "autohost.#" ] // same as above but
```

### Timestamps
Expand All @@ -116,10 +120,10 @@ Adapters should support the `timestamp` property in their configuration. To lear
The timestamp property has the following properties:

```javascript
{
local: false, // default setting
format: "YYYY-MM-DDTHH:mm:ss.SSSZ" // default setting
}
{
local: false, // default setting
format: "YYYY-MM-DDTHH:mm:ss.SSSZ" // default setting
}
```

#### Adapter Authors
Expand All @@ -141,18 +145,18 @@ var postal = require("postal");
var whistlepunk = require("whistlepunk");

var config = {
adapters: {
stdOut: {
level: 4,
bailIfDebug: true // disables stdOut if DEBUG=* is in play
},
"debug": {
level: 4
},
autohost: {
level: 4
}
}
adapters: {
stdOut: {
level: 4,
bailIfDebug: true // disables stdOut if DEBUG=* is in play
},
"debug": {
level: 4
},
autohost: {
level: 4
}
}
};
// assuming autohost instance is assigned to a "host" variable
var loggerFactory = whistlepunk(postal, config, host.fount);
Expand All @@ -179,20 +183,20 @@ Optionally, your adapter module can:
var debug = require( "debug" );
var namespaces = {};
var debugAdapter = {
onLog: function( data ) {
var debugNs = namespaces[ data.namespace ];
if ( !debugNs ) {
debugNs = namespaces[ data.namespace ] = debug( data.namespace );
}
debugNs( data.type, data.msg );
}
onLog: function( data ) {
var debugNs = namespaces[ data.namespace ];
if ( !debugNs ) {
debugNs = namespaces[ data.namespace ] = debug( data.namespace );
}
debugNs( data.type, data.msg );
}
};

// factory method returns the same instance every time
// this allows whistlepunk to prevent creating duplicate subscriptions
// which would cause duplicate log entries
module.exports = function( config ) {
return debugAdapter;
return debugAdapter;
};
```

Expand All @@ -202,31 +206,31 @@ var noOpAdapter = { onLog: function() {} };
var adapter;

function createAhAdapter( fount ) {
var host;

return {
// whistlepunk will call this when present
// and cache log messages for this adapter
// until the promise resolves
init: function() {
return fount.resolve( "ah" )
.then( function( _host ) {
host = _host;
} );
},
onLog: function( data ) {
if ( host && host.notifyClients ) {
host.notifyClients( data.type, data );
}
}
};
var host;

return {
// whistlepunk will call this when present
// and cache log messages for this adapter
// until the promise resolves
init: function() {
return fount.resolve( "ah" )
.then( function( _host ) {
host = _host;
} );
},
onLog: function( data ) {
if ( host && host.notifyClients ) {
host.notifyClients( data.type, data );
}
}
};
}

// because need fount to get a handle to the
// autohost instance, return a no-op adapter
// if it's missing
module.exports = function( config, formatter, fount ) {
adapter = adapter || ( fount ? createAhAdapter( fount ) : noOpAdapter );
return adapter;
adapter = adapter || ( fount ? createAhAdapter( fount ) : noOpAdapter );
return adapter;
};
```
38 changes: 10 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
{
"name": "whistlepunk",
"version": "0.3.3",
"homepage": "https://github.com/LeanKit-Labs/whistlepunk",
"description": "Logging abstraction that signals any enabled adapters of a new log message.",
"author": "LeanKit",
"name": "payapi-whistlepunk",
"version": "0.3.4",
"homepage": "https://github.com/payapi/whistlepunk",
"description": "Logging abstraction that signals any enabled adapters of a new log message. Forked from https://github.com/LeanKit-Labs/whistlepunk for making security upgrades to dependencies. Please use the original one once they have merged the PR's and created a release.",
"author": "payapi.io",
"repository": {
"type": "git",
"url": "git://github.com/LeanKit-Labs/whistlepunk.git"
"url": "git://github.com/payapi/whistlepunk.git"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"contributors": [
{
"name": "Jim Cowart",
"email": "[email protected]",
"url": "http://ifandelse.com"
},
{
"name": "Alex Robson",
"email": "[email protected]",
"url": "http://nerdventure.io/"
},
{
"name": "Brian Edgerton",
"url": "https://github.com/brianedgerton"
},
{
"name": "Derick Bailey",
"url": "http://derickbailey.com",
"email": "[email protected]"
},
{
"name": "Michael Tuttle",
"url": "https://github.com/openam"
"name": "Marko Haapala",
"email": "[email protected]",
"url": "https://es.linkedin.com/in/markohaapala"
}
],
"keywords": [
Expand All @@ -52,7 +34,7 @@
"debug": "2.2.0",
"lodash": "3.x",
"machina": "1.x",
"moment": "2.10.2",
"moment": "2.17.1",
"when": "3.x",
"postal": "1.x"
},
Expand Down