File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,26 @@ View android adb logcat logs in chrome devtools console
1919 DEVICE_SERIAL_xxxx device
2020 ```
2121
22- ## Usage
22+ ## Basic Usage
2323
2424``` shell
2525npx logcat-in-devtools@latest
2626```
2727
28- ### Options
28+ ## Advanced Usage
29+
30+ ``` shell
31+ # Clean logcat buffer before start and also print logcat log in terminal
32+ npx logcat-in-devtools@latest --clean --show-log
33+
34+ # only print messages which include "aaa" or "bbb" or "ccc"
35+ npx logcat-in-devtools@latest --match=" aaa\|bbb\|ccc" --show-log
36+
37+ # use device with given serial
38+ npx logcat-in-devtools@latest --serial DEVICE_SERIAL_xxxx
39+ ```
40+
41+ ### Cli options
2942
3043``` plaintext
3144$ npx logcat-in-devtools@latest --help
@@ -37,6 +50,7 @@ View android adb logcat logs in chrome devtools console
3750Options:
3851 -V, --version output the version number
3952 -c, --clean clean logcat buffer before start
53+ -l, --show-log also print logcat log in terminal
4054 -m, --match <RegExp> only print messages that match RegExp
4155 -s, --serial <SERIAL> use device with given serial (overrides $ANDROID_SERIAL)
4256 -h, --help display help for command
Original file line number Diff line number Diff line change 11{
22 "name" : " logcat-in-devtools" ,
3- "version" : " 0.1.10 " ,
3+ "version" : " 0.1.11 " ,
44 "description" : " View android adb logcat logs in chrome devtools console" ,
55 "homepage" : " https://github.com/nieheyong/logcat-in-devtools.git" ,
66 "repository" : {
Original file line number Diff line number Diff line change @@ -18,13 +18,18 @@ const packageJson = require("../package.json");
1818
1919let logPattern : RegExp | null = null ;
2020let printDisable = false ;
21+ let showLog = false ;
2122
2223function processAdbLogLine ( log : string ) {
2324 if ( printDisable ) return ;
2425
2526 if ( logPattern && ! logPattern . test ( log ) ) return ;
2627 const [ level , content ] = styleLogcatLine ( log ) ;
2728 vmLog ( level , content ) ;
29+
30+ if ( showLog ) {
31+ stdWrite ( content + "\n" ) ;
32+ }
2833}
2934
3035function togglePrint ( ) {
@@ -135,16 +140,19 @@ interface CliOptions {
135140 clean : boolean ;
136141 match : string ;
137142 serial : string ;
143+ showLog : boolean ;
138144}
139145
140146program
141147 . option ( "-c, --clean" , "clean logcat buffer before start" )
148+ . option ( "-l, --show-log" , "also print logcat log in terminal" )
142149 . option ( "-m, --match <RegExp>" , "only print messages that match RegExp" )
143150 . option (
144151 "-s, --serial <SERIAL>" ,
145152 "use device with given serial (overrides $ANDROID_SERIAL)"
146153 )
147154 . action ( ( options : CliOptions ) => {
155+ showLog = options . showLog ;
148156 run ( options ) ;
149157 } )
150158 . parse ( ) ;
You can’t perform that action at this time.
0 commit comments