Skip to content

Commit

Permalink
Add back DEBUG logging utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jan 6, 2015
1 parent cb30406 commit f47c52d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var FileEditor = require('mem-fs-editor');
var Conflicter = require('./util/conflicter');
var Storage = require('./util/storage');
var promptSuggestion = require('./util/prompt-suggestion');
var debug = require('debug')('yeoman:generator');

var fileLogger = { write: _.noop, warn: _.noop };

Expand Down Expand Up @@ -382,7 +383,10 @@ Base.prototype.run = function run(args, cb) {
}

function addMethod(method, methodName, queueName) {
self.env.runLoop.add(queueName || 'default', function (completed) {
queueName = queueName || 'default';
debug('Queueing ' + methodName + ' in ' + queueName);
self.env.runLoop.add(queueName, function (completed) {
debug('Running ' + methodName);
var done = function (err) {
if (err) self.emit('error', err);
completed();
Expand All @@ -399,6 +403,7 @@ Base.prototype.run = function run(args, cb) {
method.apply(self, args);
if (!running) return done();
} catch (err) {
debug('An error occured while running ' + methodName, err);
self.emit('error', err);
}
});
Expand Down Expand Up @@ -438,6 +443,7 @@ Base.prototype.run = function run(args, cb) {
}.bind(this));

this.on('end', function () {
debug('Running the hooked generators');
this.runHooks();
});

Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ node --debug `which yo` <generator> [arguments]
node --debug <path to yo binary> <generator> [arguments]
```

Yeoman generators also use a debug mode to log relevant informations. You can activate it by setting the `DEBUG` environment variable to the desired scope (for the generator system scope is `generators:*`).
Yeoman generators also use a debug mode to log relevant lifecycle informations. You can activate it by setting the `DEBUG` environment variable to the desired scope (the scope of the generator system is `yeoman:generator`).

```sh
# OS X / Linux
DEBUG=generators/*
DEBUG=yeoman:generator

# Windows
set DEBUG=generators/*
set DEBUG=yeoman:generator
```


Expand Down

0 comments on commit f47c52d

Please sign in to comment.