
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@devicefarmer/adbkit-logcat
Advanced tools
A Node.js interface for working with Android's logcat output.
adbkit-logcat provides a Node.js interface for working with output produced by the Android logcat tool. 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, or just advanced filtering.
Install via NPM:
npm install --save adbkit-logcat
const logcat = require('adbkit-logcat')
const {spawn} = require('child_process')
// Retrieve a binary log stream
const proc = spawn('adb', ['logcat', '-B'])
// Connect logcat to the stream
reader = logcat.readStream(proc.stdout)
reader.on('entry', entry => {
console.log(entry.message)
})
// Make sure we don't leave anything hanging
process.on('exit', () => {
proc.kill()
})
Exposes Priority. See below for details.
Exposes Reader. See below for details.
Creates a logcat reader instance from the provided logcat event Stream. Note that you must create the stream separately.
IMPORTANT: The default line break behavior has changed on newer Android versions. Since adbkit-logcat merely parses output and is not able to communicate with ADB, you must externally detect whether you need the fixLineFeeds option enabled or not. For newer versions it should be off.
'binary', which (for example) adb logcat -B produces. Defaults to 'binary'.'\n' into '\r\n', which broke binary content. If set, this option reverses the transformation before parsing the stream. Defaults to true for backwards compatibility. You MUST set this option to false on newer versions.Reader instance.The following static properties are available:
0.1. Not available when reading a stream.2.3.4.5.6.7.8. Not available when reading a stream.Static method to convert the given letter into a numeric priority. For example, Priority.fromName('d') would return Priority.DEBUG.
String. Any single, case-insensitive character matching the first character of any Priority constant is accepted.Number, or undefined.Static method to convert the given name into a numeric priority. For example, Priority.fromName('debug') (or Priority.fromName('d')) would return Priority.DEBUG.
String. Any full, case-insensitive match of the Priority constants is accepted. If no match is found, falls back to Priority.fromLetter().Number, or undefined.Static method to convert the numeric priority into its letter representation. For example, Priority.toLetter(Priority.DEBUG) would return 'D'.
Number. Any Priority constant value is accepted.String letter, or undefined.Static method to convert the numeric priority into its full string representation. For example, Priority.toLetter(Priority.DEBUG) would return 'DEBUG'.
Number. Any Priority constant value is accepted.String, or undefined.A reader instance, which is an EventEmitter.
The following events are available:
Error.Entry. See below for details.For advanced users. Manually constructs a Reader instance. Useful for testing and/or playing around. Normally you would use logcat.readStream() to create the instance.
logcat.readStream() for details.For advanced users. When instantiated manually (not via logcat.readStream()), connects the Reader instance to the given stream.
logcat.readStream() for details.Reader instance.Convenience method for ending the stream.
Reader instance.Skip 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.
'*', works the same as reader.excludeAll().Reader instance.Skip ALL entries. Alias for reader.includeAll(Priority.SILENT). Any entries you wish to see must be included via include()/includeAll().
Reader instance.Include all entries with the given tag and a priority higher or equal to the given priority.
'*', works the same as reader.includeAll(priority).Priority constant or any String value accepted by Priority.fromName() is accepted. Defaults to Priority.DEBUG.Reader instance.Include all entries with a priority higher or equal to the given priority.
reader.include() for details.Reader instance.Resets all inclusions/exclusions.
Reader instance.A log entry.
The following properties are available:
Date.Number.Number.Number. You can use logcat.Priority to convert the value into a String.String.String.Converts the entry back to the binary log format.
Buffer.See CONTRIBUTING.md.
See LICENSE.
Copyright © The OpenSTF Project. All Rights Reserved.
FAQs
A Node.js interface for working with Android's logcat output.
The npm package @devicefarmer/adbkit-logcat receives a total of 87,839 weekly downloads. As such, @devicefarmer/adbkit-logcat popularity was classified as popular.
We found that @devicefarmer/adbkit-logcat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.