Example #1
0
    def emit(self, rec):
        msg = self.format(rec)

        try:
            from UnityEngine import Debug
            if rec.levelno <= logging.DEBUG:
                Debug.LogDebug(msg)
            elif rec.levelno <= logging.INFO:
                Debug.LogInfo(msg)
            elif rec.levelno <= logging.ERROR:
                Debug.LogError(msg)
            else:
                Debug.LogError(msg)
        except:
            # f**k
            pass
Example #2
0
    def print_exception(self, context, type, value, tb):
        text = ''.join(traceback.format_exception(type, value, tb))
        del tb
        if context is not None:
            if not isinstance(context, str):
                try:
                    context = self.format_context(context)
                except:
                    text += 'Error formatting context\n' + traceback.format_exc(
                    )
                    context = repr(context)
            text += ('\n%s failed with %s\n\n' % (
                context,
                getattr(type, '__name__', 'exception'),
            ))

        try:
            from UnityEngine import Debug
            Debug.LogError(text)
        except:
            # f**k
            pass