From 710a3b36ec71537f82a7347238b57823d0d8ce5b 2011-06-20 23:40:19 From: MinRK Date: 2011-06-20 23:40:19 Subject: [PATCH] get default logger from Application.instance() --- diff --git a/IPython/parallel/apps/launcher.py b/IPython/parallel/apps/launcher.py index 41179aa..2ba117f 100644 --- a/IPython/parallel/apps/launcher.py +++ b/IPython/parallel/apps/launcher.py @@ -49,6 +49,7 @@ except ImportError: from zmq.eventloop import ioloop +from IPython.config.application import Application from IPython.config.configurable import Configurable from IPython.utils.text import EvalFormatter from IPython.utils.traitlets import Any, Int, List, Unicode, Dict, Instance @@ -107,7 +108,9 @@ class BaseLauncher(Configurable): # the work_dir option. work_dir = Unicode(u'.') loop = Instance('zmq.eventloop.ioloop.IOLoop') - log = Instance('logging.Logger', ('root',)) + log = Instance('logging.Logger') + def _log_default(self): + return Application.instance().log start_data = Any() stop_data = Any() diff --git a/IPython/parallel/apps/logwatcher.py b/IPython/parallel/apps/logwatcher.py index 960376f..7686f33 100644 --- a/IPython/parallel/apps/logwatcher.py +++ b/IPython/parallel/apps/logwatcher.py @@ -19,6 +19,7 @@ import sys import zmq from zmq.eventloop import ioloop, zmqstream +from IPython.config.application import Application from IPython.config.configurable import Configurable from IPython.utils.traitlets import Int, Unicode, Instance, List @@ -34,7 +35,9 @@ class LogWatcher(Configurable): This can subscribe to multiple topics, but defaults to all topics. """ - log = Instance('logging.Logger', ('root',)) + log = Instance('logging.Logger') + def _log_default(self): + return Application.instance().log # configurables topics = List([''], config=True, diff --git a/IPython/parallel/controller/dictdb.py b/IPython/parallel/controller/dictdb.py index bfefaa6..a7bb863 100644 --- a/IPython/parallel/controller/dictdb.py +++ b/IPython/parallel/controller/dictdb.py @@ -44,6 +44,7 @@ We support a subset of mongodb operators: from datetime import datetime +from IPython.config.application import Application from IPython.config.configurable import Configurable from IPython.utils.traitlets import Dict, Unicode, Instance @@ -83,7 +84,9 @@ class BaseDB(Configurable): """Empty Parent class so traitlets work on DB.""" # base configurable traits: session = Unicode("") - log = Instance('logging.Logger', ('root',)) + log = Instance('logging.Logger') + def _log_default(self): + return Application.instance().log class DictDB(BaseDB): """Basic in-memory dict-based object for saving Task Records. diff --git a/IPython/parallel/controller/heartmonitor.py b/IPython/parallel/controller/heartmonitor.py index 5d02c02..f679421 100644 --- a/IPython/parallel/controller/heartmonitor.py +++ b/IPython/parallel/controller/heartmonitor.py @@ -18,6 +18,7 @@ import zmq from zmq.devices import ThreadDevice from zmq.eventloop import ioloop, zmqstream +from IPython.config.application import Application from IPython.config.configurable import Configurable from IPython.utils.traitlets import Set, Instance, CFloat @@ -58,7 +59,10 @@ class HeartMonitor(Configurable): ' (in ms) [default: 100]', ) - log = Instance('logging.Logger', ('root',)) + log = Instance('logging.Logger') + def _log_default(self): + return Application.instance().log + pingstream=Instance('zmq.eventloop.zmqstream.ZMQStream') pongstream=Instance('zmq.eventloop.zmqstream.ZMQStream') loop = Instance('zmq.eventloop.ioloop.IOLoop') diff --git a/IPython/zmq/session.py b/IPython/zmq/session.py index b60d2f3..4abe114 100644 --- a/IPython/zmq/session.py +++ b/IPython/zmq/session.py @@ -31,6 +31,7 @@ from zmq.utils import jsonapi from zmq.eventloop.ioloop import IOLoop from zmq.eventloop.zmqstream import ZMQStream +from IPython.config.application import Application from IPython.config.configurable import Configurable from IPython.utils.importstring import import_item from IPython.utils.jsonutil import extract_dates, squash_dates, date_default @@ -79,7 +80,9 @@ class SessionFactory(Configurable): and IOLoop. """ - log = Instance('logging.Logger', ('', logging.WARN)) + log = Instance('logging.Logger') + def _log_default(self): + return Application.instance().log logname = Unicode('') def _logname_changed(self, name, old, new):