diff options
Diffstat (limited to 'node_modules/debug-log')
-rw-r--r-- | node_modules/debug-log/index.js | 23 | ||||
-rw-r--r-- | node_modules/debug-log/license | 21 | ||||
-rw-r--r-- | node_modules/debug-log/package.json | 37 | ||||
-rw-r--r-- | node_modules/debug-log/readme.md | 40 |
4 files changed, 121 insertions, 0 deletions
diff --git a/node_modules/debug-log/index.js b/node_modules/debug-log/index.js new file mode 100644 index 000000000..ce783650d --- /dev/null +++ b/node_modules/debug-log/index.js @@ -0,0 +1,23 @@ +'use strict'; +// https://github.com/joyent/node/blob/fbfe562d71ae8d8f8bbf627808c755e513e4e905/lib/util.js#L96-L114 +var util = require('util'); +var debugEnv = process.env.NODE_DEBUG || ''; +var cache = {}; + +module.exports = function (set) { + set = set.toUpperCase(); + + if (!cache[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnv)) { + var pid = process.pid; + + cache[set] = function () { + console.error('%s %d: %s', set, pid, util.format.apply(util, arguments)); + }; + } else { + cache[set] = function () {}; + } + } + + return cache[set]; +}; diff --git a/node_modules/debug-log/license b/node_modules/debug-log/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/debug-log/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/debug-log/package.json b/node_modules/debug-log/package.json new file mode 100644 index 000000000..c8be07696 --- /dev/null +++ b/node_modules/debug-log/package.json @@ -0,0 +1,37 @@ +{ + "name": "debug-log", + "version": "1.0.1", + "description": "Node.js 0.12 util.debuglog() ponyfill", + "license": "MIT", + "repository": "sindresorhus/debug-log", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "debug", + "log", + "logging", + "debuglog", + "built-in", + "util", + "utils", + "core", + "console", + "env", + "environment", + "ponyfill", + "polyfill", + "shim" + ] +} diff --git a/node_modules/debug-log/readme.md b/node_modules/debug-log/readme.md new file mode 100644 index 000000000..1a0e2c81c --- /dev/null +++ b/node_modules/debug-log/readme.md @@ -0,0 +1,40 @@ +# debug-log [](https://travis-ci.org/sindresorhus/debug-log) + +> Node.js 0.12 [`util.debuglog()`](http://nodejs.org/api/util.html#util_util_debuglog_section) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save debug-log +``` + + +## Usage + +```js +// example.js +var debugLog = require('debug-log')('foo'); + +debugLog('unicorns & rainbows'); +``` + +``` +$ node example.js + +``` + +``` +$ NODE_DEBUG=foo node example.js +FOO 3245: unicorns & rainbows +``` + + +## API + +See the [`util.debuglog()` docs](http://nodejs.org/api/util.html#util_util_debuglog_section). + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |