Created
May 23, 2020 13:17
-
-
Save IvanWooll/7946e2348c8171c51657d45135f1feec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import re | |
import sublime | |
import sublime_plugin | |
class OkhttplogremoveCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
for region in self.view.sel(): | |
if not region.empty(): | |
s = self.view.substr(region) | |
self.view.replace(edit, region, OkhttplogremoveCommand.remove_log(s)) | |
def remove_log(str): | |
startCharArray = re.findall(r"\n[\d]{4}-[\d]{2}-[\d]{2} [\d]{2}:[\d]{2}:[\d]{2}.[\d]{1,3}.*?D/OkHttp: ", str) | |
for s in startCharArray: | |
str = str.replace(s,"") | |
return str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ | |
"args": null, | |
"command": "select_all" | |
}, | |
{ | |
"args": null, | |
"command": "okhttplogremove" | |
}, | |
{ | |
"args": null, | |
"command": "pretty_json" | |
}, | |
{ | |
"args": {"to": "eof", "extend": false}, | |
"command": "move_to" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment