mirror of
https://github.com/imcarlost/pidcat-repl.git
synced 2026-08-08 23:17:43 -04:00
Merge pull request #51 from LouisBVL/process_parse
Allow package to specify a process as well …
This commit is contained in:
@@ -44,6 +44,13 @@ parser.add_argument('-e', '--emulator', dest='use_emulator', action='store_true'
|
||||
args = parser.parse_args()
|
||||
min_level = LOG_LEVELS_MAP[args.min_level]
|
||||
|
||||
# Store the names of packages for which to match all processes.
|
||||
catchall_package = filter(lambda package: package.find(":") == -1, args.package)
|
||||
# Store the name of processes to match exactly.
|
||||
named_processes = filter(lambda package: package.find(":") != -1, args.package)
|
||||
# Convert default process names from <package>: (cli notation) to <package> (android notation) in the exact names match group.
|
||||
named_processes = map(lambda package: package if package.find(":") != len(package) - 1 else package[:-1], named_processes)
|
||||
|
||||
header_size = args.tag_width + 1 + 3 + 1 # space, level, space
|
||||
|
||||
width = -1
|
||||
@@ -157,8 +164,10 @@ app_pid = None
|
||||
def match_packages(token):
|
||||
if len(args.package) == 0:
|
||||
return True
|
||||
if token in named_processes:
|
||||
return True
|
||||
index = token.find(':')
|
||||
return (token in args.package) if index == -1 else (token[:index] in args.package)
|
||||
return (token in catchall_package) if index == -1 else (token[:index] in catchall_package)
|
||||
|
||||
def parse_death(tag, message):
|
||||
if tag != 'ActivityManager':
|
||||
|
||||
Reference in New Issue
Block a user