Skip to content

Instantly share code, notes, and snippets.

@IvanWooll
Created May 23, 2020 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanWooll/7946e2348c8171c51657d45135f1feec to your computer and use it in GitHub Desktop.
Save IvanWooll/7946e2348c8171c51657d45135f1feec to your computer and use it in GitHub Desktop.
# -*- 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
[
{
"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