@@ -82,7 +82,7 @@ def main():
8282 parser .disable_interspersed_args () # stop when on option without an '-'
8383 options , args = parser .parse_args ()
8484
85- root_logger = logging .getLogger ('' )
85+ root_logger = logging .getLogger ('virtualenvwrapper ' )
8686
8787 # Set up logging to a file
8888 logfile = os .environ .get ('VIRTUALENVWRAPPER_LOG_FILE' )
@@ -98,7 +98,7 @@ def main():
9898 root_logger .addHandler (file_handler )
9999
100100 # Send higher-level messages to the console, too
101- console = logging .StreamHandler ()
101+ console = logging .StreamHandler (stream = sys . stderr )
102102 console_level = [logging .WARNING ,
103103 logging .INFO ,
104104 logging .DEBUG ,
@@ -107,6 +107,7 @@ def main():
107107 formatter = logging .Formatter ('%(name)s %(message)s' )
108108 console .setFormatter (formatter )
109109 root_logger .addHandler (console )
110+ root_logger .setLevel (console_level )
110111
111112 # logging.getLogger(__name__).debug('cli args %s', args)
112113
@@ -125,7 +126,7 @@ def main():
125126 if options .sourcing :
126127 hook += '_source'
127128
128- log = logging .getLogger (__name__ )
129+ log = logging .getLogger ('virtualenvwrapper.hook_loader' )
129130
130131 log .debug ('Running %s hooks' , hook )
131132 run_hooks (hook , options , args )
@@ -147,13 +148,16 @@ def main():
147148
148149
149150def run_hooks (hook , options , args , output = None ):
151+ log = logging .getLogger ('virtualenvwrapper.hook_loader' )
150152 if output is None :
151153 output = sys .stdout
152154
153155 namespace = 'virtualenvwrapper.%s' % hook
154156 if options .names :
157+ log .debug ('looking for %s hooks %s' % (namespace , options .names ))
155158 hook_mgr = NamedExtensionManager (namespace , options .names )
156159 else :
160+ log .debug ('looking for %s hooks' % namespace )
157161 hook_mgr = ExtensionManager (namespace )
158162
159163 if options .listing :
@@ -169,6 +173,7 @@ def show(ext):
169173 def get_source (ext , args ):
170174 # Show the shell commands so they can
171175 # be run in the calling shell.
176+ log .debug ('getting source instructions for %s' % ext .name )
172177 contents = (ext .plugin (args ) or '' ).strip ()
173178 if contents :
174179 output .write ('# %s\n ' % ext .name )
@@ -182,6 +187,7 @@ def get_source(ext, args):
182187 else :
183188 # Just run the plugin ourselves
184189 def invoke (ext , args ):
190+ log .debug ('running %s' % ext .name )
185191 ext .plugin (args )
186192 try :
187193 hook_mgr .map (invoke , args [1 :])
0 commit comments