diff --git a/IPython/frontend/html/notebook/azurenbmanager.py b/IPython/frontend/html/notebook/azurenbmanager.py index b6f635e..f7f60a7 100644 --- a/IPython/frontend/html/notebook/azurenbmanager.py +++ b/IPython/frontend/html/notebook/azurenbmanager.py @@ -139,5 +139,5 @@ class AzureNotebookManager(NotebookManager): else: self.delete_notebook_id(notebook_id) - def log_info(self): - self.log.info("Serving notebooks from Azure storage: %s, %s", self.account_name, self.container) + def info_string(self): + return "Serving notebooks from Azure storage: %s, %s" % (self.account_name, self.container) diff --git a/IPython/frontend/html/notebook/filenbmanager.py b/IPython/frontend/html/notebook/filenbmanager.py index 4ecf77f..832f9fb 100644 --- a/IPython/frontend/html/notebook/filenbmanager.py +++ b/IPython/frontend/html/notebook/filenbmanager.py @@ -191,6 +191,6 @@ class FileNotebookManager(NotebookManager): else: i = i+1 return name - - def log_info(self): - self.log.info("Serving notebooks from local directory: %s", self.notebook_dir) + + def info_string(self): + return "Serving notebooks from local directory: %s" % self.notebook_dir diff --git a/IPython/frontend/html/notebook/nbmanager.py b/IPython/frontend/html/notebook/nbmanager.py index 42de93c..e7a1dbf 100644 --- a/IPython/frontend/html/notebook/nbmanager.py +++ b/IPython/frontend/html/notebook/nbmanager.py @@ -207,4 +207,8 @@ class NotebookManager(LoggingConfigurable): return notebook_id def log_info(self): - self.log.info("Serving notebooks") \ No newline at end of file + self.log.info(self.info_string()) + + def info_string(self): + return "Serving notebooks" + diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 896a0f9..d9470c6 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -581,8 +581,8 @@ class NotebookApp(BaseIPythonApplication): time.sleep(0.1) info = self.log.info info('interrupted') - self.print_notebook_info() - info("Shutdown this notebook server (y/[n])? ") + print self.notebook_info() + sys.stdout.write("Shutdown this notebook server (y/[n])? ") sys.stdout.flush() r,w,x = select.select([sys.stdin], [], [], 5) if r: @@ -605,7 +605,7 @@ class NotebookApp(BaseIPythonApplication): ioloop.IOLoop.instance().stop() def _signal_info(self, sig, frame): - self.print_notebook_info() + print self.notebook_info() @catch_config_error def initialize(self, argv=None): @@ -624,10 +624,10 @@ class NotebookApp(BaseIPythonApplication): self.log.info('Shutting down kernels') self.kernel_manager.shutdown_all() - def print_notebook_info(self): - "Print the current working directory and the server url information" - self.notebook_manager.log_info() - self.log.info("The IPython Notebook is running at: %s" % self._url) + def notebook_info(self): + "Return the current working directory and the server url information" + mgr_info = self.notebook_manager.info_string() + "\n" + return mgr_info +"The IPython Notebook is running at: %s" % self._url def start(self): """ Start the IPython Notebok server app, after initialization @@ -639,7 +639,8 @@ class NotebookApp(BaseIPythonApplication): info = self.log.info self._url = "%s://%s:%i%s" % (proto, ip, self.port, self.base_project_url) - self.print_notebook_info() + for line in self.notebook_info().split("\n"): + info(line) info("Use Control-C to stop this server and shut down all kernels.") if self.open_browser or self.file_to_run: