import sys
from enum import IntEnum

class Verbosity(IntEnum):
    NONE = 0
    MINIMUM = 1
    NORMAL = 2
    DEBUG = 3

class Logger:
    VERBOSITY = Verbosity.NORMAL

    # Colors
    DEFAULT      = '\033[0m'
    BLACK        = '\033[0;30m'
    RED          = '\033[0;31m'
    GREEN        = '\033[0;32m'
    ORANGE       = '\033[0;33m'
    BLUE         = '\033[0;34m'
    PURPLE       = '\033[0;35m'
    CYAN         = '\033[0;36m'
    LIGHT_GRAY   = '\033[0;37m'
    DARK_GRAY    = '\033[1;30m'
    LIGHT_RED    = '\033[1;31m'
    LIGHT_GREEN  = '\033[1;32m'
    YELLOW       = '\033[1;33m'
    LIGHT_BLUE   = '\033[1;34m'
    LIGHT_PURPLE = '\033[1;35m'
    LIGHT_CYAN   = '\033[1;36m'
    WHITE        = '\033[1;37m'

    @staticmethod
    def write(verbosity, message = '', end = '\n'):
        if Logger.VERBOSITY >= verbosity:
            print(message, end=end)

    @staticmethod
    def space(verbosity):
        Logger.write(verbosity)

    @staticmethod
    def fatal(verbosity, error, message = '', end = '\n'):
        Logger.error(verbosity, message, end)
        sys.exit(error)

    @staticmethod
    def error(verbosity, message = '', end = '\n'):
        Logger.write(verbosity, Logger.RED + '[-] ' + message + Logger.DEFAULT, end)

    @staticmethod
    def warning(verbosity, message = '', end = '\n'):
        Logger.write(verbosity, Logger.ORANGE + '[!] ' + message + Logger.DEFAULT, end)

    @staticmethod
    def info(verbosity, message = '', end = '\n'):
        Logger.write(verbosity, Logger.BLUE + '[#] ' + Logger.DEFAULT + message, end)

    @staticmethod
    def success(verbosity, message = '', end = '\n'):
        Logger.write(verbosity, Logger.GREEN + '[+] ' + Logger.DEFAULT + message, end)