{ "name": "bower-logger", "version": "0.2.2", "description": "The logger used in the various architecture components of Bower.", "author": { "name": "Twitter" }, "licenses": [ { "type": "MIT", "url": "https://github.com/bower/logger/blob/master/LICENSE" } ], "repository": { "type": "git", "url": "git://github.com/bower/logger.git" }, "main": "lib/Logger", "engines": { "node": ">=0.8.0" }, "devDependencies": { "expect.js": "~0.2.0", "mocha": "~1.12.0" }, "scripts": { "test": "mocha -R spec" }, "readme": "# bower-logger [![Build Status](https://secure.travis-ci.org/bower/logger.png?branch=master)](http://travis-ci.org/bower/logger)\n\nThe logger used in the various architecture components of Bower.\n\n\n## Usage\n\n### .error(id, message, data)\n\nAlias to `.log('error', id. message, data)`\n\n\n### .conflict(id, message, data)\n\nAlias to `.log('conflict', id. message, data)`\n\n\n### .warn(id, message, data)\n\nAlias to `.log('warn', id. message, data)`\n\n\n### .action(id, message, data)\n\nAlias to `.log('action', id. message, data)`\n\n\n### .info(id, message, data)\n\nAlias to `.log('info', id. message, data)`\n\n\n### .debug(id, message, data)\n\nAlias to `.log('debug', id. message, data)`\n\n\n### .log(level, id, message, data)\n\nEmits a `log` event, with an object like so:\n\n```js\nlogger.log('warn', 'foo', 'bar', { dog: 'loves cat' })\n{\n level: 'warn',\n id: 'foo',\n message: 'bar',\n data: {\n dog: 'loves cat'\n }\n}\n```\n\n\n### .prompt(prompts, callback)\n\nEmits a `prompt` event with an array of `prompts` with a `callback`. \n`prompts` can be an object or an array of objects. The `callback` will be called with an\nthe answer or an object of answers (if prompts was only one or an array respectively).\nThe `callback` is guaranteed to run only once.\n\n```js\nlogger.on('prompt', function (prompts, callback) {\n // \"prompts\" is always an array of prompts\n // Call \"callback\" with an object of answers when done\n\n // In this example, we will use the inquirer module to do the\n // prompting for us\n inquirer(prompts, callback);\n})\n\nlogger.prompt({\n type: 'input' // Can be 'input', 'confirm' or 'password'\n message: 'Type something',\n validate: function (value) {\n if (value !== 'I am awesome') {\n return 'You must type \"I am awesome\"'\n }\n\n return true;\n }\n}, function (err, answer) {\n // Error will only happen on unsupported 'type'\n if (err) {\n return console.error(err.message);\n }\n\n console.log(answer);\n});\n\n\n```\n\n\n### .pipe(logger)\n\nPipes all logger events to another logger. \nBasically all events emitted with `.emit()` will get piped.\n\n\n### .geminate()\n\nCreates a new logger that pipes events to the parent logger. \nAlias for `(new Logger()).pipe(logger)`.\n\n\n### .intercept(fn)\n\nIntercepts `log` events, calling `fn` before listeners of the instance.\n\n\n### #LEVELS\n\nA static property that contains an object where keys are the recognized log levels and values their importance. \nThe higher the importance, the more important the level is.\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/bower/logger/issues" }, "homepage": "https://github.com/bower/logger#readme", "_id": "bower-logger@0.2.2", "_shasum": "39be07e979b2fc8e03a94634205ed9422373d381", "_resolved": "https://registry.npmjs.org/bower-logger/-/bower-logger-0.2.2.tgz", "_from": "bower-logger@>=0.2.2 <0.3.0" }