def debug(msg='', key='', **args): """ Debug log message :param str msg: text message :param str key: message key for template :param mixed args: additional arguments :raise TplError :return: None """ msg = str(msg) try: if key: msg = Tpl.__format_message(key, args=args) logger.log('debug').debug(msg) except (AttributeError, TplError) as error: raise TplError(error)
def warning(msg='', key='', **args): """ Warning log message :param str msg: text message :param str key: message key for template :param dict args: additional arguments :raise TplError :return: None """ msg = str(msg) try: if key: msg = Tpl.__format_message(key, args=args) logger.log('warning').warning(msg) except (AttributeError, TplError) as e: raise TplError(e.message)
def info(msg='', key='', clear=False, **args): """ Info log message :param str msg: text message :param str key: message key for template :param mixed args: additional arguments :param bool clear: clear prev line :raise TplError :return: None """ msg = str(msg) try: if key: msg = Tpl.__format_message(key, args=args) if True is clear: sys.writels("") logger.log('info').info(msg) except (AttributeError, TplError) as error: raise TplError(error)
def cancel(msg='', key='', **args): """ Print message and stop propagation :param str msg: text message :param str key: message key for template :param mixed args: additional arguments :raise TplError :return: None """ try: if key: msg = Tpl.__format_message(key, args=args) sys.exit(logger.log().warning(msg)) except (AttributeError, TplError) as error: raise TplError(error)