@@ -82,7 +82,7 @@ def main():
82
82
parser .disable_interspersed_args () # stop when on option without an '-'
83
83
options , args = parser .parse_args ()
84
84
85
- root_logger = logging .getLogger ('' )
85
+ root_logger = logging .getLogger ('virtualenvwrapper ' )
86
86
87
87
# Set up logging to a file
88
88
logfile = os .environ .get ('VIRTUALENVWRAPPER_LOG_FILE' )
@@ -98,7 +98,7 @@ def main():
98
98
root_logger .addHandler (file_handler )
99
99
100
100
# Send higher-level messages to the console, too
101
- console = logging .StreamHandler ()
101
+ console = logging .StreamHandler (stream = sys . stderr )
102
102
console_level = [logging .WARNING ,
103
103
logging .INFO ,
104
104
logging .DEBUG ,
@@ -107,6 +107,7 @@ def main():
107
107
formatter = logging .Formatter ('%(name)s %(message)s' )
108
108
console .setFormatter (formatter )
109
109
root_logger .addHandler (console )
110
+ root_logger .setLevel (console_level )
110
111
111
112
# logging.getLogger(__name__).debug('cli args %s', args)
112
113
@@ -125,7 +126,7 @@ def main():
125
126
if options .sourcing :
126
127
hook += '_source'
127
128
128
- log = logging .getLogger (__name__ )
129
+ log = logging .getLogger ('virtualenvwrapper.hook_loader' )
129
130
130
131
log .debug ('Running %s hooks' , hook )
131
132
run_hooks (hook , options , args )
@@ -147,13 +148,16 @@ def main():
147
148
148
149
149
150
def run_hooks (hook , options , args , output = None ):
151
+ log = logging .getLogger ('virtualenvwrapper.hook_loader' )
150
152
if output is None :
151
153
output = sys .stdout
152
154
153
155
namespace = 'virtualenvwrapper.%s' % hook
154
156
if options .names :
157
+ log .debug ('looking for %s hooks %s' % (namespace , options .names ))
155
158
hook_mgr = NamedExtensionManager (namespace , options .names )
156
159
else :
160
+ log .debug ('looking for %s hooks' % namespace )
157
161
hook_mgr = ExtensionManager (namespace )
158
162
159
163
if options .listing :
@@ -169,6 +173,7 @@ def show(ext):
169
173
def get_source (ext , args ):
170
174
# Show the shell commands so they can
171
175
# be run in the calling shell.
176
+ log .debug ('getting source instructions for %s' % ext .name )
172
177
contents = (ext .plugin (args ) or '' ).strip ()
173
178
if contents :
174
179
output .write ('# %s\n ' % ext .name )
@@ -182,6 +187,7 @@ def get_source(ext, args):
182
187
else :
183
188
# Just run the plugin ourselves
184
189
def invoke (ext , args ):
190
+ log .debug ('running %s' % ext .name )
185
191
ext .plugin (args )
186
192
try :
187
193
hook_mgr .map (invoke , args [1 :])
0 commit comments