Esempio n. 1
0
def cli(debug):
    globalvars.DEBUG = debug
    if debug:
        # TODO make debug mode print using different formatter
        pass
    else:
        MODULE_LOGGER.setLevel(logging.INFO)
Esempio n. 2
0
def main(args):
    try:
        from systoolbox.commands.update import update
        cli.add_command(update)
        from systoolbox.commands.vim import vim
        cli.add_command(vim)
        cli(args, standalone_mode=False)
    except click.ClickException as e:
        e.show()
    except KeyboardInterrupt:
        MODULE_LOGGER.warning('Interrupted.')
    except click.Abort:
        MODULE_LOGGER.warning('Interrupted.')
    except Exception as e:
        if globalvars.DEBUG:
            MODULE_LOGGER.exception(e)
        else:
            MODULE_LOGGER.error(str(e))
Esempio n. 3
0
import os
import sys

CURRENT_DIR = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(CURRENT_DIR, '..'))

from systoolbox.log import MODULE_LOGGER

MODULE_LOGGER.debug('this is debug')
MODULE_LOGGER.info('this is info')
MODULE_LOGGER.warning('this is warning')
MODULE_LOGGER.error('this is error')
try:
    raise Exception('this is exception')
except Exception as e:
    MODULE_LOGGER.error('this is error with exception', exc_info=True)
    MODULE_LOGGER.handlers[0].flush()
    MODULE_LOGGER.exception(e)
MODULE_LOGGER.critical('this is critical')