def wrappedfunc(nb, resources):
     from IPython.config import Application
     if Application.initialized():
         Application.instance().log.debug(
             "Applying preprocessor: %s", function.__name__
         )
     for worksheet in nb.worksheets:
         for index, cell in enumerate(worksheet.cells):
             worksheet.cells[index], resources = function(cell, resources, index)
     return nb, resources
예제 #2
0
 def wrappedfunc(nb, resources):
     from IPython.config import Application
     if Application.initialized():
         Application.instance().log.debug("Applying preprocessor: %s",
                                          function.__name__)
     for worksheet in nb.worksheets:
         for index, cell in enumerate(worksheet.cells):
             worksheet.cells[index], resources = function(
                 cell, resources, index)
     return nb, resources
예제 #3
0
def _logger():
    """get the logger for the current Application
    
    the root logger will be used if no Application is running
    """
    if Application.initialized():
        logger = Application.instance().log
    else:
        logger = logging.getLogger()
        if not logger.handlers:
            logging.basicConfig()

    return logger
예제 #4
0
def _logger():
    """get the logger for the current Application
    
    the root logger will be used if no Application is running
    """
    if Application.initialized():
        logger = Application.instance().log
    else:
        logger = logging.getLogger()
        if not logger.handlers:
            logging.basicConfig()
    
    return logger
예제 #5
0
def get_logger():
    """Grab the global logger instance.

    If a global IPython Application is instantiated, grab its logger.
    Otherwise, grab the root logger.
    """
    global _logger

    if _logger is None:
        from IPython.config import Application
        if Application.initialized():
            _logger = Application.instance().log
        else:
            logging.basicConfig()
            _logger = logging.getLogger()
    return _logger
예제 #6
0
def get_logger():
    """Grab the global logger instance.
    
    If a global IPython Application is instantiated, grab its logger.
    Otherwise, grab the root logger.
    """
    global _logger

    if _logger is None:
        from IPython.config import Application
        if Application.initialized():
            _logger = Application.instance().log
        else:
            logging.basicConfig()
            _logger = logging.getLogger()
    return _logger
def set_engine_logger():
    '''Updates EMA logging on the engines with an EngineLoggerAdapter 
    This adapter injects EMA as a topic into all messages
    '''
    
    logger = Application.instance().log
    logger.setLevel(ema_logging.DEBUG)

    for handler in logger.handlers:
        if isinstance(handler, IPython.kernel.zmq.log.EnginePUBHandler): # @UndefinedVariable
            handler.setLevel(ema_logging.DEBUG)
    
    adapter = EngingeLoggerAdapter(logger, SUBTOPIC)
    ema_logging._logger = adapter
    
    ema_logging.debug('updated logger')
예제 #8
0
파일: handlers.py 프로젝트: Kiiwi/Syssel
 def log(self):
     """use the IPython log by default, falling back on tornado's logger"""
     if Application.initialized():
         return Application.instance().log
     else:
         return app_log
예제 #9
0
 def log(self):
     """use the IPython log by default, falling back on tornado's logger"""
     if Application.initialized():
         return Application.instance().log
     else:
         return app_log
예제 #10
0
# IPython.parallel - can I write my own log into the engine logs?
from IPython.config import Application

log = Application.instance().log
예제 #11
0
# IPython.parallel - can I write my own log into the engine logs?
from IPython.config import Application
log = Application.instance().log