Created
September 16, 2016 21:21
-
-
Save yeputons/bcf613a5f334827b00b5af442cee1926 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python | |
import re | |
import sys | |
with open(sys.argv[1]) as f: | |
data = f.read() | |
mapping = { | |
"kInfo": "INFO", | |
"kWarning": "WARN", | |
"kError": "ERROR", | |
"kFatal": "FATAL" | |
} | |
for src, dest in mapping.items(): | |
data = re.sub("([^\s]+)->Message\((\s*)%s," % src, "PS_LOG_%s(\\2\\1," % dest, data) | |
data = re.sub("([^\s]+)\.Message\((\s*)%s," % src, "PS_LOG_%s(\\2(&\\1)," % dest, data) | |
with open(sys.argv[1], "w") as f: | |
f.write(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment