#!/usr/bin/env python3
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from argparse import ArgumentParser
from opensnitch.ui import QtApp
import logging
import signal


parser = ArgumentParser()
parser.add_argument("--debug", dest="debug",
                    action="store_true", default=False,
                    help="Enable debug logs")


if __name__ == '__main__':
    args = parser.parse_args()

    logging.basicConfig(
        format='[%(asctime)s] (%(levelname)s) %(message)s',
        level=logging.INFO if args.debug is False else logging.DEBUG)

    # Handle ctrl-c
    # note that this will cause any finally blocks and similar cleanups
    # to not get executed
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    app = QtApp()
    app.run()
