diff --git a/templates/new/dodo.py.txt b/templates/new/dodo.py.txt index 7bbcffba..a492608f 100644 --- a/templates/new/dodo.py.txt +++ b/templates/new/dodo.py.txt @@ -7,6 +7,7 @@ import sys import subprocess import re import webbrowser +import logging from pathlib import Path @@ -18,6 +19,7 @@ CONFIG = Config(os.path.dirname(__file__)) DOIT_CONFIG = {{'verbosity':2}} PACKAGE_PATH = os.path.basename(CONFIG["package_path"]) IMAGE = "%s/%s:%s" % (CONFIG["company"], CONFIG["image"], CONFIG["version"]) +LOGGER = logging.getLogger(__name__) PARAMS = [ {{ @@ -237,7 +239,7 @@ def task_jupyter(): stderr=subprocess.PIPE, encoding='utf-8') - print("Starting jupyter notbook server...\n") + LOGGER.info("Starting jupyter notbook server...\n") # Get the IP address of the container, otherwise use localhost ip_process = subprocess.Popen( @@ -261,7 +263,7 @@ def task_jupyter(): break if process.poll(): - print("Failed to start the server, check if its not running somewhere else!") + LOGGER.error("Failed to start the server, check if its not running somewhere else!") # Stop any containers that might be running process = subprocess.Popen( @@ -278,15 +280,15 @@ def task_jupyter(): # Open the browser automatically webbrowser.open('http://%s:55910/tree' % host, new=2) - print("Notebook URL: http://%s:55910/tree\n" % host) - print("Use CTRL+C to stop the server.") + LOGGER.info("Notebook URL: http://%s:55910/tree\n", host) + LOGGER.info("Use CTRL+C to stop the server.") try: process.wait() except KeyboardInterrupt: pass finally: - print("Closing server...") + LOGGER.info("Closing server...") process = subprocess.Popen( [ 'docker', diff --git a/templates/new/web_dodo.py.txt b/templates/new/web_dodo.py.txt index fa3fbe16..02263a6c 100644 --- a/templates/new/web_dodo.py.txt +++ b/templates/new/web_dodo.py.txt @@ -7,6 +7,7 @@ import sys import subprocess import re import webbrowser +import logging from pathlib import Path @@ -18,6 +19,7 @@ CONFIG = Config(os.path.dirname(__file__)) DOIT_CONFIG = {{'verbosity':2}} PACKAGE_PATH = os.path.basename(CONFIG["package_path"]) IMAGE = "%s/%s:%s" % (CONFIG["company"], CONFIG["image"], CONFIG["version"]) +LOGGER = logging.getLogger(__name__) PARAMS = [ {{ @@ -285,7 +287,7 @@ def task_jupyter(): stderr=subprocess.PIPE, encoding='utf-8') - print("Starting jupyter notbook server...\n") + LOGGER.info("Starting jupyter notbook server...\n") # Get the IP address of the container, otherwise use localhost ip_process = subprocess.Popen( @@ -309,7 +311,7 @@ def task_jupyter(): break if process.poll(): - print("Failed to start the server, please try again!") + LOGGER.error("Failed to start the server, please try again!") # Stop any containers that might be running process = subprocess.Popen( @@ -326,15 +328,15 @@ def task_jupyter(): # Open the browser automatically webbrowser.open('http://%s:55910/tree' % host, new=2) - print("Notebook URL: http://%s:55910/tree\n" % host) - print("Use CTRL+C to stop the server.") + LOGGER.info("Notebook URL: http://%s:55910/tree\n", host) + LOGGER.info("Use CTRL+C to stop the server.") try: process.wait() except KeyboardInterrupt: pass finally: - print("Closing server...") + LOGGER.info("Closing server...") process = subprocess.Popen( [ 'docker',