{"_id":"adbkit-logcat","_rev":"303474","name":"adbkit-logcat","description":"A Node.js interface for working with Android's logcat output.","dist-tags":{"latest":"2.0.1"},"maintainers":[{"name":"cyberagent","email":"npm@cyberagent.co.jp"},{"name":"sorccu","email":""}],"time":{"modified":"2021-06-03T19:23:34.000Z","created":"2013-11-26T09:31:25.047Z","2.0.1":"2017-10-22T04:22:49.216Z","2.0.0":"2017-10-21T16:43:18.263Z","1.1.0":"2016-08-22T09:46:22.882Z","1.0.3":"2014-05-14T10:55:41.187Z","1.0.0":"2013-11-26T09:31:25.047Z"},"users":{},"author":{"name":"The OpenSTF Project","email":"contact@openstf.io","url":"https://openstf.io"},"repository":{"type":"git","url":"git+https://github.com/openstf/adbkit-logcat.git"},"versions":{"2.0.1":{"name":"adbkit-logcat","version":"2.0.1","description":"A Node.js interface for working with Android's logcat output.","keywords":["adb","adbkit","logcat"],"bugs":{"url":"https://github.com/openstf/adbkit-logcat/issues"},"license":"Apache-2.0","author":{"name":"The OpenSTF Project","email":"contact@openstf.io","url":"https://openstf.io"},"main":"./index","repository":{"type":"git","url":"git+https://github.com/openstf/adbkit-logcat.git"},"scripts":{"test":"mocha --recursive"},"dependencies":{},"devDependencies":{"chai":"^3.5.0","mocha":"^3.0.2","sinon":"^1.17.5","sinon-chai":"^2.8.0"},"engines":{"node":">= 4"},"gitHead":"be30ce5f07355f1241da7c307186fbad97b8c875","homepage":"https://github.com/openstf/adbkit-logcat#readme","_id":"adbkit-logcat@2.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.6.0","_npmUser":{"name":"sorccu","email":"simo@shoqolate.com"},"dist":{"shasum":"d4986b9fc7cfda42733389d46a52124abef43ca5","size":6129,"noattachment":false,"key":"/adbkit-logcat/-/adbkit-logcat-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/adbkit-logcat/download/adbkit-logcat-2.0.1.tgz"},"maintainers":[{"name":"cyberagent","email":"npm@cyberagent.co.jp"},{"name":"sorccu","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adbkit-logcat-2.0.1.tgz_1508646169142_0.7809894278179854"},"directories":{},"publish_time":1508646169216,"_hasShrinkwrap":false,"_cnpm_publish_time":1508646169216},"2.0.0":{"name":"adbkit-logcat","version":"2.0.0","description":"A Node.js interface for working with Android's logcat output.","keywords":["adb","adbkit","logcat"],"bugs":{"url":"https://github.com/openstf/adbkit-logcat/issues"},"license":"Apache-2.0","author":{"name":"The OpenSTF Project","email":"contact@openstf.io","url":"https://openstf.io"},"main":"./index","repository":{"type":"git","url":"git+https://github.com/openstf/adbkit-logcat.git"},"scripts":{"test":"mocha --recursive"},"dependencies":{},"devDependencies":{"chai":"^3.5.0","mocha":"^3.0.2","sinon":"^1.17.5","sinon-chai":"^2.8.0"},"engines":{"node":">= 4"},"gitHead":"84ce686fea4ef5e566ff94db445735d638cf8706","homepage":"https://github.com/openstf/adbkit-logcat#readme","_id":"adbkit-logcat@2.0.0","_npmVersion":"5.3.0","_nodeVersion":"8.6.0","_npmUser":{"name":"sorccu","email":"simo@shoqolate.com"},"dist":{"shasum":"18276b8d047f3b1379dba195a68b417f0a5b4999","size":6077,"noattachment":false,"key":"/adbkit-logcat/-/adbkit-logcat-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/adbkit-logcat/download/adbkit-logcat-2.0.0.tgz"},"maintainers":[{"name":"cyberagent","email":"npm@cyberagent.co.jp"},{"name":"sorccu","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adbkit-logcat-2.0.0.tgz_1508604198177_0.01069479389116168"},"directories":{},"publish_time":1508604198263,"_hasShrinkwrap":false,"_cnpm_publish_time":1508604198263},"1.1.0":{"name":"adbkit-logcat","version":"1.1.0","description":"A Node.js interface for working with Android's logcat output.","keywords":["adb","adbkit","logcat"],"bugs":{"url":"https://github.com/openstf/adbkit-logcat/issues"},"license":"Apache-2.0","author":{"name":"The OpenSTF Project","email":"contact@openstf.io","url":"https://openstf.io"},"main":"./index","repository":{"type":"git","url":"git+https://github.com/openstf/adbkit-logcat.git"},"scripts":{"postpublish":"grunt clean","prepublish":"grunt coffee","test":"grunt test"},"dependencies":{},"devDependencies":{"chai":"^3.5.0","coffee-script":"^1.10.0","grunt":"^1.0.1","grunt-cli":"^1.2.0","grunt-coffeelint":"0.0.16","grunt-contrib-clean":"^1.0.0","grunt-contrib-coffee":"^1.0.0","grunt-contrib-watch":"^1.0.0","grunt-exec":"^1.0.0","grunt-jsonlint":"^1.1.0","grunt-notify":"^0.4.5","mocha":"^3.0.2","sinon":"^1.17.5","sinon-chai":"^2.8.0"},"engines":{"node":">= 0.10.4"},"gitHead":"7a3321703d08158da90762946deb79606a7d463c","homepage":"https://github.com/openstf/adbkit-logcat#readme","_id":"adbkit-logcat@1.1.0","_shasum":"01d7f9b0cef9093a30bcb3b007efff301508962f","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"sorccu","email":"simo@shoqolate.com"},"dist":{"shasum":"01d7f9b0cef9093a30bcb3b007efff301508962f","size":6467,"noattachment":false,"key":"/adbkit-logcat/-/adbkit-logcat-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/adbkit-logcat/download/adbkit-logcat-1.1.0.tgz"},"maintainers":[{"name":"cyberagent","email":"npm@cyberagent.co.jp"},{"name":"sorccu","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/adbkit-logcat-1.1.0.tgz_1471859181120_0.29749698215164244"},"directories":{},"publish_time":1471859182882,"_cnpm_publish_time":1471859182882,"_hasShrinkwrap":false},"1.0.3":{"name":"adbkit-logcat","version":"1.0.3","description":"A Node.js interface for working with Android's logcat output.","keywords":["adb","adbkit","logcat"],"bugs":{"url":"https://github.com/CyberAgent/adbkit-logcat/issues"},"license":"Apache-2.0","author":{"name":"CyberAgent, Inc.","email":"npm@cyberagent.co.jp","url":"http://www.cyberagent.co.jp/"},"main":"./index","repository":{"type":"git","url":"https://github.com/CyberAgent/adbkit-logcat.git"},"scripts":{"postpublish":"grunt clean","prepublish":"grunt coffee","test":"grunt test"},"dependencies":{},"devDependencies":{"chai":"~1.8.1","coffee-script":"~1.6.3","grunt":"~0.4.1","grunt-cli":"~0.1.11","grunt-coffeelint":"~0.0.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-coffee":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-exec":"~0.4.2","grunt-jsonlint":"~1.0.2","grunt-notify":"~0.2.16","mocha":"~1.14.0","sinon":"~1.7.3","sinon-chai":"~2.4.0"},"engines":{"node":">= 0.10.4"},"homepage":"https://github.com/CyberAgent/adbkit-logcat","_id":"adbkit-logcat@1.0.3","dist":{"shasum":"8b5fef57086c02c9e24004af5706ee508d83db07","size":6382,"noattachment":false,"key":"/adbkit-logcat/-/adbkit-logcat-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/adbkit-logcat/download/adbkit-logcat-1.0.3.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"sorccu","email":"simo@shoqolate.com"},"maintainers":[{"name":"cyberagent","email":"npm@cyberagent.co.jp"},{"name":"sorccu","email":""}],"directories":{},"publish_time":1400064941187,"_cnpm_publish_time":1400064941187,"_hasShrinkwrap":false},"1.0.0":{"name":"adbkit-logcat","version":"1.0.0","description":"A Node.js interface for working with Android's logcat output.","keywords":["adb","adbkit","logcat"],"bugs":{"url":"https://github.com/CyberAgent/adbkit-logcat/issues"},"license":"Apache-2.0","author":{"name":"CyberAgent, Inc.","email":"npm@cyberagent.co.jp","url":"http://www.cyberagent.co.jp/"},"main":"./index","repository":{"type":"git","url":"https://github.com/CyberAgent/adbkit-logcat.git"},"scripts":{"postpublish":"grunt clean","prepublish":"grunt coffee","test":"grunt test"},"dependencies":{"async":"~0.2.9"},"devDependencies":{"chai":"~1.8.1","coffee-script":"~1.6.3","grunt":"~0.4.1","grunt-cli":"~0.1.11","grunt-coffeelint":"~0.0.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-coffee":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-exec":"~0.4.2","grunt-jsonlint":"~1.0.2","grunt-notify":"~0.2.16","mocha":"~1.14.0","sinon":"~1.7.3","sinon-chai":"~2.4.0"},"engines":{"node":">= 0.10.4"},"readmeFilename":"README.md","homepage":"https://github.com/CyberAgent/adbkit-logcat","_id":"adbkit-logcat@1.0.0","dist":{"shasum":"4c0f511f4c0313a252355244858b3470e812e032","size":6298,"noattachment":false,"key":"/adbkit-logcat/-/adbkit-logcat-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/adbkit-logcat/download/adbkit-logcat-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"sorccu","email":"simo@shoqolate.com"},"maintainers":[{"name":"cyberagent","email":"npm@cyberagent.co.jp"},{"name":"sorccu","email":""}],"directories":{},"publish_time":1385458285047,"_hasShrinkwrap":false,"_cnpm_publish_time":1385458285047}},"readme":"# adbkit-logcat\n\n**adbkit-logcat** provides a [Node.js][nodejs] interface for working with output produced by the Android [`logcat` tool][logcat-site]. It takes a log stream (that you must create separately), parses it, and emits log entries in real-time as they occur. Possible use cases include storing logs in a database, forwarding logs via [MessagePack][msgpack], or just advanced filtering.\n\n## Requirements\n\n* [Node.js](http://nodejs.org/) 4.x or newer. Older versions are not supported.\n\n## Getting started\n\nInstall via NPM:\n\n```bash\nnpm install --save adbkit-logcat\n```\n\n### Examples\n\n#### Output all log messages\n\n##### JavaScript\n\n```javascript\nconst logcat = require('adbkit-logcat')\nconst {spawn} = require('child_process')\n\n// Retrieve a binary log stream\nconst proc = spawn('adb', ['logcat', '-B'])\n\n// Connect logcat to the stream\nreader = logcat.readStream(proc.stdout)\nreader.on('entry', entry => {\n  console.log(entry.message)\n})\n\n// Make sure we don't leave anything hanging\nprocess.on('exit', () => {\n  proc.kill()\n})\n```\n\n## API\n\n### Logcat\n\n#### logcat.Priority\n\nExposes `Priority`. See below for details.\n\n#### logcat.Reader\n\nExposes `Reader`. See below for details.\n\n#### logcat.readStream(stream[, options])\n\nCreates a logcat reader instance from the provided logcat event [`Stream`][node-stream]. Note that you must create the stream separately.\n\n* **stream** The event stream to read.\n* **options** Optional. The following options are supported:\n    - **format** The format of the stream. Currently, the only supported value is `'binary'`, which (for example) `adb logcat -B` produces. Defaults to `'binary'`.\n    - **fixLineFeeds** All programs run via the ADB shell transform any `'\\n'` in the output to `'\\r\\n'`, which breaks binary content. If set, this option reverses the transformation before parsing the stream. Defaults to `true`.\n* Returns: The `Reader` instance.\n\n### Priority\n\n#### Constants\n\nThe following static properties are available:\n\n* **Priority.UNKNOWN** i.e. `0`.\n* **Priority.DEFAULT** i.e. `1`. Not available when reading a stream.\n* **Priority.VERBOSE** i.e. `2`.\n* **Priority.DEBUG** i.e. `3`.\n* **Priority.INFO** i.e. `4`.\n* **Priority.WARN** i.e. `5`.\n* **Priority.ERROR** i.e. `6`.\n* **Priority.FATAL** i.e. `7`.\n* **Priority.SILENT** i.e. `8`. Not available when reading a stream.\n\n#### Priority.fromLetter(letter)\n\nStatic method to convert the given `letter` into a numeric priority. For example, `Priority.fromName('d')` would return `Priority.DEBUG`.\n\n* **letter** The priority as a `String`. Any single, case-insensitive character matching the first character of any `Priority` constant is accepted.\n* Returns: The priority as a `Number`, or `undefined`.\n\n#### Priority.fromName(name)\n\nStatic method to convert the given `name` into a numeric priority. For example, `Priority.fromName('debug')` (or `Priority.fromName('d')`) would return `Priority.DEBUG`.\n\n* **name** The priority as a `String`. Any full, case-insensitive match of the `Priority` constants is accepted. If no match is found, falls back to `Priority.fromLetter()`.\n* Returns: The priority as a `Number`, or `undefined`.\n\n#### Priority.toLetter(priority)\n\nStatic method to convert the numeric priority into its letter representation. For example, `Priority.toLetter(Priority.DEBUG)` would return `'D'`.\n\n* **priority** The priority as a `Number`. Any `Priority` constant value is accepted.\n* Returns: The priority as a `String` letter, or `undefined`.\n\n#### Priority.toName(priority)\n\nStatic method to convert the numeric priority into its full string representation. For example, `Priority.toLetter(Priority.DEBUG)` would return `'DEBUG'`.\n\n* **priority** The priority as a `Number`. Any `Priority` constant value is accepted.\n* Returns: The priority as a `String`, or `undefined`.\n\n### Reader\n\nA reader instance, which is an [`EventEmitter`][node-events].\n\n#### Events\n\nThe following events are available:\n\n* **error** **(err)** Emitted when an error occurs.\n    * **err** An `Error`.\n* **end** Emitted when the stream ends.\n* **finish** Emitted when the stream finishes.\n* **entry** **(entry)** Emitted when the stream finishes.\n    * **entry** A log `Entry`. See below for details.\n\n#### constructor([options])\n\nFor advanced users. Manually constructs a `Reader` instance. Useful for testing and/or playing around. Normally you would use `logcat.readStream()` to create the instance.\n\n* **options** See `logcat.readStream()` for details.\n* Returns: N/A\n\n#### reader.connect(stream)\n\nFor advanced users. When instantiated manually (not via `logcat.readStream()`), connects the `Reader` instance to the given stream.\n\n* **stream** See `logcat.readStream()` for details.\n* Returns: The `Reader` instance.\n\n#### reader.end()\n\nConvenience method for ending the stream.\n\n* Returns: The `Reader` instance.\n\n#### reader.exclude(tag)\n\nSkip entries with the provided tag. Alias for `reader.include(tag, Priority.SILENT)`. Note that even skipped events have to be parsed so that they can be ignored.\n\n* **tag** The tag string to exclude. If `'*'`, works the same as `reader.excludeAll()`.\n* Returns: The `Reader` instance.\n\n#### reader.excludeAll()\n\nSkip **ALL** entries. Alias for `reader.includeAll(Priority.SILENT)`. Any entries you wish to see must be included via `include()`/`includeAll()`.\n\n* Returns: The `Reader` instance.\n\n#### reader.include(tag[, priority])\n\nInclude all entries with the given tag and a priority higher or equal to the given `priority`.\n\n* **tag** The tag string to include. If `'*'`, works the same as `reader.includeAll(priority)`.\n* **priority** Optional. A lower bound for the priority. Any numeric `Priority` constant or any `String` value accepted by `Priority.fromName()` is accepted. Defaults to `Priority.DEBUG`.\n* Returns: The `Reader` instance.\n\n#### reader.includeAll([priority])\n\nInclude all entries with a priority higher or equal to the given `priority`.\n\n* **tag** The tag string to exclude.\n* **priority** Optional. See `reader.include()` for details.\n* Returns: The `Reader` instance.\n\n#### reader.resetFilters()\n\nResets all inclusions/exclusions.\n\n* Returns: The `Reader` instance.\n\n### Entry\n\nA log entry.\n\n#### Properties\n\nThe following properties are available:\n\n* **date** Event time as a `Date`.\n* **pid** Process ID as a `Number`.\n* **tid** Thread ID as a `Number`.\n* **priority** Event priority as a `Number`. You can use `logcat.Priority` to convert the value into a `String`.\n* **tag** Event tag as a `String`.\n* **message** Message as a `String`.\n\n#### entry.toBinary()\n\nConverts the entry back to the binary log format.\n\n* Returns: The binary event as a [`Buffer`][node-buffer].\n\n## More information\n\n* [logprint.c](https://github.com/android/platform_system_core/blob/master/liblog/logprint.c)\n* [logcat.cpp](https://github.com/android/platform_system_core/blob/master/logcat/logcat.cpp)\n* [logger.h](https://github.com/android/platform_system_core/blob/master/include/log/logger.h)\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nSee [LICENSE](LICENSE).\n\nCopyright © The OpenSTF Project. All Rights Reserved.\n\n[nodejs]: <http://nodejs.org/>\n[msgpack]: <http://msgpack.org/>\n[logcat-site]: <http://developer.android.com/tools/help/logcat.html>\n[node-stream]: <http://nodejs.org/api/stream.html>\n[node-events]: <http://nodejs.org/api/events.html>\n[node-buffer]: <http://nodejs.org/api/buffer.html>\n","_attachments":{},"homepage":"https://github.com/openstf/adbkit-logcat#readme","bugs":{"url":"https://github.com/openstf/adbkit-logcat/issues"},"license":"Apache-2.0"}