Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue #1, #2 process/message level filtering implemented.

  • Loading branch information...
commit fb8fddaec3f1072d079fdc005a041869513249dd 1 parent 7aab554
@quarnster authored
Showing with 63 additions and 2 deletions.
  1. +7 −0 Context.sublime-menu
  2. +9 −0 README.creole
  3. +47 −2 adbview.py
View
7 Context.sublime-menu
@@ -0,0 +1,7 @@
+[
+ { "caption": "-", "id": "adb" },
+ { "command": "adb_filter_by_process_id", "caption": "ADB Filter by Process ID" },
+ { "command": "adb_filter_by_process_name", "caption": "ADB Filter by Process Name"},
+ { "command": "adb_filter_by_message_level", "caption": "ADB Filter by Message Level"},
+ { "command": "adb_set_filter", "caption": "ADB Custom Regular Expression Filter"}
+]
View
9 README.creole
@@ -21,6 +21,15 @@ Please go [[https://github.com/quarnster/ADBView/issues?sort=created&direction=d
=== Usage ===
After installation, hit ctrl+alt+d to open up an ADB logcat view.
+Message filters can be set by clicking a line in the logcat view and then right click and choose one of the menu options:
+
+ # ADB Filter by Process ID
+ # ADB Filter by Process Name
+ # ADB Filter by Message Level
+ # ADB Custom Regular Expression Filter
+
+You can also specify a custom regular expression filter in the preferences or project settings.
+
=== License ===
This plugin is using the zlib license
View
49 adbview.py
@@ -90,6 +90,7 @@ def clear(self):
def set_filter(self, filter):
try:
self.filter = re.compile(filter)
+ self.apply_filter()
except:
sublime.error_message("invalid regex")
@@ -136,7 +137,7 @@ def update(self):
try:
while True:
cmd, data = self.queue.get_nowait()
- if cmd == ADBView.LINE:
+ if cmd == ADBView.LINE and self.filter.search(data) != None:
self.view.set_read_only(False)
e = self.view.begin_edit()
row, col = self.view.rowcol(self.view.size())
@@ -185,6 +186,48 @@ def output(pipe):
traceback.print_exc()
+class AdbFilterByProcessId(sublime_plugin.TextCommand):
+ def run(self, edit):
+ data = self.view.substr(self.view.full_line(self.view.sel()[0].a))
+ match = re.match("./.+\( *(\d+)\)", data)
+ if match != None:
+ adb_view.set_filter("\( *%s\)" % match.group(1))
+
+ def is_enabled(self):
+ return adb_view.is_open() and adb_view.get_view().id() == self.view.id()
+
+ def is_visible(self):
+ return self.is_enabled()
+
+
+class AdbFilterByProcessName(sublime_plugin.TextCommand):
+ def run(self, edit):
+ data = self.view.substr(self.view.full_line(self.view.sel()[0].a))
+ match = re.match("./(.+)\( *\d+\)", data)
+ if match != None:
+ adb_view.set_filter("%s\( *\d+\)" % match.group(1))
+
+ def is_enabled(self):
+ return adb_view.is_open() and adb_view.get_view().id() == self.view.id()
+
+ def is_visible(self):
+ return self.is_enabled()
+
+
+class AdbFilterByMessageLevel(sublime_plugin.TextCommand):
+ def run(self, edit):
+ data = self.view.substr(self.view.full_line(self.view.sel()[0].a))
+ match = re.match("(\w)/.+\( *\d+\)", data)
+ if match != None:
+ adb_view.set_filter("%s/.+\( *\d+\)" % match.group(1))
+
+ def is_enabled(self):
+ return adb_view.is_open() and adb_view.get_view().id() == self.view.id()
+
+ def is_visible(self):
+ return self.is_enabled()
+
+
class AdbLaunch(sublime_plugin.WindowCommand):
def run(self):
global adb_process
@@ -202,7 +245,6 @@ def is_enabled(self):
class AdbSetFilter(sublime_plugin.WindowCommand):
def set_filter(self, data):
adb_view.set_filter(data)
- adb_view.apply_filter()
def run(self):
self.window.show_input_panel("ADB Regex filter", adb_view.filter.pattern, self.set_filter, None, None)
@@ -210,6 +252,9 @@ def run(self):
def is_enabled(self):
return adb_process != None and adb_view.is_open()
+ def is_visible(self):
+ return self.is_enabled()
+
class AdbEventListener(sublime_plugin.EventListener):
def on_close(self, view):
Please sign in to comment.
Something went wrong with that request. Please try again.