Socket
Socket
Sign inDemoInstall

logkitty

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logkitty - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

build/adb.d.ts

78

build/cli.js

@@ -11,9 +11,2 @@ "use strict";

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -23,6 +16,7 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const adbkit_logcat_1 = __importStar(require("adbkit-logcat"));
const yargs_1 = __importDefault(require("yargs"));
const processEntry_1 = __importDefault(require("./processEntry"));
const adb_1 = require("./adb");
const LogcatReader_1 = __importDefault(require("./LogcatReader"));
const utils_1 = require("./utils");
const formatters_1 = require("./formatters");
const priorityOptions = {

@@ -51,3 +45,4 @@ U: {

.command('tag <tags ...>', 'Show logs matching given tags', priorityOptions)
.command('app <appId>', 'Show logs only from given application', priorityOptions)
.command('app <appId>', 'Show logs from application with given identifier', priorityOptions)
.command('match <regexes...>', 'Show logs matching given patterns', priorityOptions)
.command('custom <patterns ...>', 'Filter using custom patterns <tag>:<priority>')

@@ -59,2 +54,3 @@ .command('all', 'Show all logs', priorityOptions)

.example('$0 app com.example.myApp', 'Show all logs from com.example.myApp')
.example('$0 match device', 'Show all logs matching /device/gm regex')
.example('$0 app com.example.myApp -E', 'Show all logs from com.example.myApp with priority ERROR and above')

@@ -75,34 +71,34 @@ .example('$0 custom *:S MyTag:D', 'Silence all logs and show only ones with MyTag with priority DEBUG and above')

};
// Clear buffer
child_process_1.execSync('adb logcat -c');
const pid = command === 'app'
? parseInt(child_process_1.execSync(`adb shell pidof -s ${args.appId}`).toString(), 10)
: -1;
const logcatProcess = child_process_1.spawn('adb', ['logcat', '-B'], {
stdio: 'pipe',
});
process.on('exit', () => {
logcatProcess.kill();
});
const reader = adbkit_logcat_1.default.readStream(logcatProcess.stdout, { fixLineFeeds: false });
if (command === 'custom') {
args.patterns.forEach((patter) => {
const [tag, priorityLetter] = patter.split(':');
const priority = adbkit_logcat_1.Priority.fromLetter(priorityLetter);
if (tag === '*' && priority === adbkit_logcat_1.Priority.SILENT) {
reader.excludeAll();
}
else if (tag === '*' && priority !== adbkit_logcat_1.Priority.SILENT) {
reader.includeAll(priority);
}
else {
reader.include(tag, priority);
}
try {
const adbPath = adb_1.getAbdPath();
const targetProcessId = command === 'app'
? adb_1.getApplicationPid(adbPath, args.appId)
: undefined;
const logcatProcess = adb_1.spawnLogcatProcess(adbPath);
process.on('exit', () => {
logcatProcess.kill();
});
const reader = new LogcatReader_1.default(logcatProcess.stdout);
reader.onEntry = (entry) => {
process.stdout.write(formatters_1.formatEntry(entry));
};
if (command === 'custom') {
reader.setCustomPatterns(args.patterns);
}
else {
reader.setFilter(command, {
tags: args.tags,
processId: targetProcessId,
regexes: args.regexes
? args.regexes.map((value) => new RegExp(value))
: undefined,
minPriority: utils_1.getMinPriority(selectedPriorities),
});
}
}
reader.on('entry', processEntry_1.default(command, {
priorities: selectedPriorities,
pid,
tags: args.tags || [],
}));
catch (error) {
// tslint:disable-next-line: no-console
console.log(formatters_1.formatError(error));
process.exit(1);
}
//# sourceMappingURL=cli.js.map
{
"name": "logkitty",
"version": "0.1.0",
"version": "0.2.0",
"description": "Display pretty Logcat logs without Android Studio with intuitive Command Line Interface.",
"keywords": ["logcat", "cli", "android", "android studio", "logging"],
"keywords": [
"logcat",
"cli",
"android",
"android studio",
"logging"
],
"repository": {

@@ -29,3 +35,3 @@ "type": "git",

"adbkit-logcat": "^2.0.1",
"ansi-fragments": "^0.1.0",
"ansi-fragments": "^0.2.0",
"yargs": "^12.0.5"

@@ -32,0 +38,0 @@ },

@@ -37,2 +37,3 @@ # logkitty

* `app <appId>` - Show logs from application with given identifier.
* `match <regexes...>` - Show logs matching given patterns (all regexes have flags `g` and `m`).
* `custom <patterns...>` - Use custom [patters supported by Logcat](https://developer.android.com/studio/command-line/logcat#filteringOutput).

@@ -43,3 +44,3 @@ * `all` - Show all logs.

`tag`, `app` and `all` commands support additional filtering options (sorted by priority):
`tag`, `app`, `match` and `all` commands support additional filtering options (sorted by priority):

@@ -71,2 +72,8 @@ * `-U, -u` - Unknown priority (lowest)

Show all logs matching `/CodePush/gm` regex:
```
logkitty match CodePush
```
Show all logs with priority __error__ or __fatal__:

@@ -73,0 +80,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc