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
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
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
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 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