Last active
August 29, 2015 14:24
-
-
Save nabeelio/10e0047123d5ebc2f0dd to your computer and use it in GitHub Desktop.
multitail
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
#!/usr/bin/env python | |
import sys | |
import random | |
import argparse | |
from fabric.operations import local | |
COLORS = ['green', 'blue', 'yellow', 'red'] | |
CMD = ['multitail -mb 10MB --follow-all -n 100'] | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-m', action='store_true', default=False, | |
help='merge all logs into single output') | |
parser.add_argument('files', nargs='*') | |
args = parser.parse_args() | |
sys.argv.pop(0) | |
for file in args.files: | |
color = random.choice(COLORS) | |
CMD.append('-ci %s ' % color) | |
if len(CMD) > 1 and args.m: | |
CMD.append('-I') | |
CMD.append(file) | |
CMD = ' '.join(CMD) | |
local(CMD) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment