Display pretty Android and iOS logs without Android Studio or Console.app, with intuitive Command Line Interface.
npm install @talaikis/logkittyjs
const { logkitty, makeTagsFilter, formatEntry, formatError, AndroidPriority } = require('@talaikis/logkitty')
const { logger } = require('@react-native-community/cli-tools')
async function logAndroid () {
logger.info('Starting logkitty')
const emitter = logkitty({
platform: 'android',
priority: AndroidPriority.VERBOSE,
filter: makeTagsFilter('ReactNative', 'ReactNativeJS')
})
emitter.on('entry', entry => {
logger.log(formatEntry(entry))
})
emitter.on('error', error => {
logger.log(formatError(error));
})
}
`
Installation
`sh
yarn global add @talaikis/logkitty
`
Or if you prefer having it locally:
`sh
yarn add -D @talaikis/logkitty
yarn logkitty --help
`
Usage
`sh
logkitty [options]
`
$3
You can inspect available platforms, command and options for a given platform by adding -h at the end, for example:
`sh
logkitty -h # prints available platforms and global options
logkitty android -h # prints commands and options for android
logkitty android tag -h # prints tag command syntax and options for android
`
$3
* platform: android:
* tag - Show logs with matching tags.
* app - Show logs from application with given identifier.
* match - Show logs matching given patterns (all regexes have flags g and m).
* custom - Use custom patters supported by Logcat.
* all - Show all logs.
* platform: ios:
* tag - Show logs with matching tags (where tag is usually a name of the app).
* match - Show logs matching given patterns (all regexes have flags g and m).
* all - Show all logs.
$3
* common:
* -h, --help - Display help
* -v, --version - Display version
* platform android:
tag, app, match and all commands support additional priority filtering options (sorted by priority):
* -U, -u - Unknown priority (lowest)
* -v, -v - Verbose priority
* -D, -d - Debug priority (default)
* -I, -i - Info priority
* -W, -w - Warn priority
* -E, -e - Error priority
* -F, -f - Fatal priority
* -S, -s - Silent priority (highest)
For example logkitty android all -W will display all logs with priority __warn__, __error__ and __fatal__.
* platform ios:
tag, match and all commands support additional level filtering options:
* -D, -d - Debug level
* -I, -i - Info level
* -E, -e - Error level
$3
Show all logs with tag ReactNativeJS (and default priority - __debug and above__):
`sh
logkitty android tag ReactNativeJS
logkitty ios tag ReactNativeJS
`
Show all logs with priority __info and above__ from application with identifier com.example.myApplication:
`sh
logkitty android app com.example.myApplication -i
`
Show all logs matching /CodePush/gm regex:
`sh
logkitty android match CodePush
logkitty ios match CodePush
`
Show all logs with priority __error__ or __fatal__ for Android and __error_ level for iOS:
`sh
logkitty android all -e
logkitty ios all -e
`
Show logs using custom patterns - silence all logs and display only the onces with tag my-tag and priority __debug and above__:
`sh
logkitty android custom *:S my-tag:D
``