trains/logger.py
def console(self, msg, level=logging.INFO, omit_console=False, *args, **kwargs):
        """
        print text to log (same as print to console, and also prints to console)

        :param msg: text to print to the console (always send to the backend and displayed in console)
        :param level: logging level, default: logging.INFO
        :param omit_console: If True we only send 'msg' to log (no console print)
        """
        try:
            level = int(level)
        except (TypeError, ValueError):
            self._task.log.log(level=logging.ERROR,
                               msg='Logger failed casting log level "%s" to integer' % str(level))
            level = logging.INFO

        try:
            record = self._task.log.makeRecord(
                "console", level=level, fn='', lno=0, func='', msg=msg, args=args, exc_info=None
            )
            # find the task handler
            if not self._task_handler:
                self._task_handler = [h for h in LoggerRoot.get_base_logger().handlers if isinstance(h, TaskHandler)][0]
            self._task_handler.emit(record)
        except Exception:
            self._task.log.log(level=logging.ERROR,
                               msg='Logger failed sending log: [level %s]: "%s"' % (str(level), str(msg)))

        if not omit_console:
            # if we are here and we grabbed the stdout, we need to print the real thing
            if DevWorker.report_stdout:
                try:
                    # make sure we are writing to the original stdout
                    Logger._stdout_original_write(str(msg)+'\n')
                except Exception:
                    pass
            else:
                print(str(msg))

        # if task was not started, we have to start it
        self._start_task_if_needed()

        print text to log (same as print to console, and also prints to console)

        :param msg: text to print to the console (always send to the backend and displayed in console)
        :param level: logging level, default: logging.INFO
        :param omit_console: If True we only send 'msg' to log (no console print)
        
print text to log (same as print to console, and also prints to console)
print text to log ( same as print to console and also prints to console )
def console(self, msg, level=logging.INFO, omit_console=False, *args, **kwargs):
        try:
            level = int(level)
        except (TypeError, ValueError):
            self._task.log.log(level=logging.ERROR,
                               msg='Logger failed casting log level "%s" to integer' % str(level))
            level = logging.INFO
        try:
            record = self._task.log.makeRecord(
                "console", level=level, fn='', lno=0, func='', msg=msg, args=args, exc_info=None
            )
            if not self._task_handler:
                self._task_handler = [h for h in LoggerRoot.get_base_logger().handlers if isinstance(h, TaskHandler)][0]
            self._task_handler.emit(record)
        except Exception:
            self._task.log.log(level=logging.ERROR,
                               msg='Logger failed sending log: [level %s]: "%s"' % (str(level), str(msg)))
        if not omit_console:
            if DevWorker.report_stdout:
                try:
                    Logger._stdout_original_write(str(msg)+'\n')
                except Exception:
                    pass
            else:
                print(str(msg))
        self._start_task_if_needed()
def console ( self , msg , level = logging . INFO , omit_console = False , * args , ** kwargs ) : try : level = int ( level ) except ( TypeError , ValueError ) : self . _task . log . log ( level = logging . ERROR , msg = 'Logger failed casting log level "%s" to integer' % str ( level ) ) level = logging . INFO try : record = self . _task . log . makeRecord ( "console" , level = level , fn = '' , lno = 0 , func = '' , msg = msg , args = args , exc_info = None ) if not self . _task_handler : self . _task_handler = [ h for h in LoggerRoot . get_base_logger ( ) . handlers if isinstance ( h , TaskHandler ) ] [ 0 ] self . _task_handler . emit ( record ) except Exception : self . _task . log . log ( level = logging . ERROR , msg = 'Logger failed sending log: [level %s]: "%s"' % ( str ( level ) , str ( msg ) ) ) if not omit_console : if DevWorker . report_stdout : try : Logger . _stdout_original_write ( str ( msg ) + '\n' ) except Exception : pass else : print ( str ( msg ) ) self . _start_task_if_needed ( )
print text to log (same as print to console, and also prints to console)
print text to log ( same as print to console and also prints to console )
"""
        print text to log (same as print to console, and also prints to console)

        :param msg: text to print to the console (always send to the backend and displayed in console)
        :param level: logging level, default: logging.INFO
        :param omit_console: If True we only send 'msg' to log (no console print)
        """ # find the task handler # if we are here and we grabbed the stdout, we need to print the real thing # make sure we are writing to the original stdout # if task was not started, we have to start it
self
msg
text to print to the console (always send to the backend and displayed in console)
text to print to the console ( always send to the backend and displayed in console )
level
logging level, default: logging.INFO
logging level default : logging . INFO
omit_console
If True we only send 'msg' to log (no console print)
If True we only send ' msg ' to log ( no console print )