Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [qrtt1@qrtt1-laptop dev]$ cat decorator.py
- #!/usr/bin/python
- import sys
- from colorama import init
- from colorama import Fore, Back, Style
- BLOCK_LIST = [
- "WifiService",
- "TelephonyRegistry",
- "Gmail",
- "NotificationService",
- "WifiMonitor",
- "WifiStateTracker",
- "NetworkStateTracker",
- "ConnectivityService",
- "GpsLocationProvider",
- "ResponseProcessCookies",
- "dun_service",
- "PowerManagerService",
- "wpa_supplicant",
- "SyncManager",
- "KeyguardViewMediator",
- "InputManagerService",
- "WifiWatchdogService"
- ]
- HIGH_LIGHTS = {}
- HIGH_LIGHTS["System.out"]=Back.GREEN + Fore.CYAN
- def isblocked(m):
- for b in BLOCK_LIST:
- if m.find(b) != -1:
- return True
- return False
- def my_color(m):
- for h in HIGH_LIGHTS.keys():
- if m.find(h) !=-1:
- return decorate(HIGH_LIGHTS[h], m)
- return None
- def decorate(color, m):
- return color + m + Fore.RESET + Back.RESET + Style.RESET_ALL
- if __name__ == "__main__":
- init()
- while True:
- line = sys.stdin.readline()
- m = line.strip()
- if isblocked(m):
- continue
- k = my_color(m)
- if k is not None:
- print k
- continue
- if m.startswith("E"):
- print decorate(Fore.RED + Style.BRIGHT, m)
- elif m.startswith("W"):
- print decorate(Fore.BLUE + Style.BRIGHT, m)
- elif m.startswith("I"):
- print decorate(Fore.YELLOW, m)
- elif m.startswith("D"):
- print decorate(Fore.CYAN, m)
- else:
- print decorate(Fore.BLACK + Style.BRIGHT, m);
Advertisement
Add Comment
Please, Sign In to add comment