Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default logcat format to threadtime #31

Merged
merged 3 commits into from Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions ADBView.sublime-settings
Expand Up @@ -3,7 +3,7 @@
"adb_command": "adb",

// ADB arguments that should be used.
"adb_args": ["logcat", "-v", "time"],
"adb_args": ["logcat", "-v", "threadtime"],

// Set to false to disable auto scroll of the ADB view
"adb_auto_scroll": true,
Expand All @@ -13,7 +13,7 @@
"adb_snap_lines": 5,

// Max number of lines in the adb logcat buffer
"adb_maxlines": 20000,
"adb_maxlines": 100000,

// A regex filter that is used when selecting which lines to display
"adb_filter": ".",
Expand Down
3 changes: 2 additions & 1 deletion Context.sublime-menu
@@ -1,7 +1,8 @@
[
{ "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_tag_name", "caption": "ADB Filter by Tag Name" },
{ "command": "adb_filter_by_thread_id", "caption": "ADB Filter By Thread ID" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "filter by process name" feature still makes sense. Could you just add a new command for "filter by thread id", instead of replacing an existing one? Also, could you update README.md for the new added command as well?

{ "command": "adb_filter_by_message_level", "caption": "ADB Filter by Message Level" },
{ "command": "adb_filter_by_debuggable_apps", "caption": "ADB Filter by Debuggable Apps" },
{ "command": "adb_filter_by_containing_selections", "caption": "ADB Filter by Containing Selections" },
Expand Down
3 changes: 2 additions & 1 deletion README.creole
Expand Up @@ -25,7 +25,8 @@ 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 Tag Name
# ADB Filter by Thread ID
# ADB Filter by Message Level
# ADB Filter by Debuggable Apps
# ADB Custom Regular Expression Filter
Expand Down
47 changes: 24 additions & 23 deletions adb.tmLanguage
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

<dict>
<key>name</key>
<string>Android Debug Bridge</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>^([\d\- :.]*)(F)\/(.*)\( *(\d+)\): (.*)</string>
<string>^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (F) ([^\:]*): (.*)</string>
<key>captures</key>
<dict>
<key>1</key>
Expand All @@ -19,17 +20,17 @@
<key>2</key>
<dict>
<key>name</key>
<string>invalid.illegal.adb</string>
<string>constant.other.adb</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
<string>invalid.illegal.adb</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.other.adb</string>
<string>entity.name.function</string>
</dict>
<key>5</key>
<dict>
Expand All @@ -40,7 +41,7 @@
</dict>
<dict>
<key>match</key>
<string>^([\d\- :.]*)(E)\/(.*)\( *(\d+)\): (.*)</string>
<string>^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (E) ([^\:]*): (.*)</string>
<key>captures</key>
<dict>
<key>1</key>
Expand All @@ -51,17 +52,17 @@
<key>2</key>
<dict>
<key>name</key>
<string>invalid.illegal.adb</string>
<string>constant.other.adb</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
<string>invalid.illegal.adb</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.other.adb</string>
<string>entity.name.function</string>
</dict>
<key>5</key>
<dict>
Expand All @@ -72,7 +73,7 @@
</dict>
<dict>
<key>match</key>
<string>^([\d\- :.]*)(D)\/(.*)\( *(\d+)\): (.*)</string>
<string>^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (D) ([^\:]*): (.*)</string>
<key>captures</key>
<dict>
<key>1</key>
Expand All @@ -83,17 +84,17 @@
<key>2</key>
<dict>
<key>name</key>
<string>comment.adb</string>
<string>constant.other.adb</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
<string>comment.adb</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.other.adb</string>
<string>entity.name.function</string>
</dict>
<key>5</key>
<dict>
Expand All @@ -104,7 +105,7 @@
</dict>
<dict>
<key>match</key>
<string>^([\d\- :.]*)(W)\/(.*)\( *(\d+)\): (.*)</string>
<string>^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (W) ([^\:]*): (.*)</string>
<key>captures</key>
<dict>
<key>1</key>
Expand All @@ -115,17 +116,17 @@
<key>2</key>
<dict>
<key>name</key>
<string>keyword.adb</string>
<string>constant.other.adb</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
<string>keyword.adb</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.other.adb</string>
<string>entity.name.function</string>
</dict>
<key>5</key>
<dict>
Expand All @@ -136,7 +137,7 @@
</dict>
<dict>
<key>match</key>
<string>^([\d\- :.]*)(I)\/(.*)\( *(\d+)\): (.*)</string>
<string>^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (I) ([^\:]*): (.*)</string>
<key>captures</key>
<dict>
<key>1</key>
Expand All @@ -147,17 +148,17 @@
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.filename.adb</string>
<string>constant.other.adb</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
<string>entity.name.filename.adb</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>constant.other.adb</string>
<string>entity.name.function</string>
</dict>
<key>5</key>
<dict>
Expand All @@ -168,20 +169,20 @@
</dict>
<dict>
<key>match</key>
<string>^([\d\- :.]*)(.)\/(.*)\( *(\d+)\): (.*)</string>
<string>^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (.) ([^\:]*): (.*)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>constant.other.adb.timestamp</string>
</dict>
<key>3</key>
<key>4</key>
<dict>
<key>name</key>
<string>entity.name.function</string>
</dict>
<key>4</key>
<key>5</key>
<dict>
<key>name</key>
<string>constant.other.adb</string>
Expand Down
30 changes: 22 additions & 8 deletions adbview.py
Expand Up @@ -362,9 +362,9 @@ def run(self, e, data):
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(r"[\-\d\s:.]*./.+\( *(\d+)\)", data)
match = re.match(r"^\d+\-\d+ [\d\:\.]* +(\d+) +\d+ . ", data)
if match != None:
set_filter(self.view, "\( *%s\)" % match.group(1))
set_filter(self.view, "^\d+\-\d+ [\d\:\.]* +%s" % match.group(1))
else:
sublime.error_message("Couldn't extract process id")

Expand All @@ -374,15 +374,29 @@ def is_enabled(self):
def is_visible(self):
return self.is_enabled()

class AdbFilterByTagName(sublime_plugin.TextCommand):
def run(self, edit):
data = self.view.substr(self.view.full_line(self.view.sel()[0].a))
match = re.match(r"^\d+\-\d+ [\d\:\.]* +\d+ +\d+ ([^\:]*):", data)
if match != None:
set_filter(self.view, "^\d+\-\d+ [\d\:\.]* +\d+ +\d+ %s:" % match.group(1))
else:
sublime.error_message("Couldn't extract tag name")

def is_enabled(self):
return is_adb_syntax(self.view)

def is_visible(self):
return self.is_enabled()

class AdbFilterByProcessName(sublime_plugin.TextCommand):
class AdbFilterByThreadId(sublime_plugin.TextCommand):
def run(self, edit):
data = self.view.substr(self.view.full_line(self.view.sel()[0].a))
match = re.match(r"[\-\d\s:.]*./(.+)\( *\d+\)", data)
match = re.match(r"^\d+\-\d+ [\d\:\.]* +(\d+) +(\d+) .", data)
if match != None:
set_filter(self.view, "%s\( *\d+\)" % match.group(1))
set_filter(self.view, "^\d+\-\d+ [\d\:\.]* +%s +%s+" % (match.group(1), match.group(2)))
else:
sublime.error_message("Couldn't extract process name")
sublime.error_message("Couldn't extract thread id")

def is_enabled(self):
return is_adb_syntax(self.view)
Expand All @@ -394,9 +408,9 @@ def is_visible(self):
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(r"[\-\d\s:.]*(\w)/.+\( *\d+\)", data)
match = re.match(r"^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (.)", data)
if match != None:
set_filter(self.view, "%s/.+\( *\d+\)" % match.group(1))
set_filter(self.view, "^(\d+\-\d+ [\d\:\.]*) +(\d+ +\d+) (%s)" % match.group(3))
else:
sublime.error_message("Couldn't extract Message level")

Expand Down