#!/usr/bin/python2
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from argus_gui import Logger
import argparse
import sys

"""
log.py - Called by all Argus GUIs to display the progress and errors of any Argus operation.  Not intended for users directly.  If you want to take advantage of argus_gui's logging abilities,
use the class Logger directly.
"""

if __name__ == '__main__':
    # parses through the passed arguments for the command and options
    cmd = sys.argv[1:]

    # are we going to write a log?
    if cmd[0] == 'True':
        write = True
    else:
        write = False

    # temporary directory
    tmp = cmd[1]
    # actual command to run and display its stdout and stderr
    cmd = cmd[2:]

    # start doing stuff
    log = Logger(cmd, tmp = tmp, wLog = write)
    log.start()
