LogInfoPlugin.js 1.0 KB

12345678910111213141516171819202122232425
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. function LogInfoPlugin(source) {
  6. this.source = source;
  7. }
  8. module.exports = LogInfoPlugin;
  9. LogInfoPlugin.prototype.apply = function(resolver) {
  10. var source = this.source;
  11. resolver.plugin(this.source, function(request, callback) {
  12. if(!callback.log) return callback();
  13. var log = callback.log;
  14. var prefix = "[" + source + "] ";
  15. if(request.path) log(prefix + "Resolving in directory: " + request.path);
  16. if(request.request) log(prefix + "Resolving request: " + request.request);
  17. if(request.module) log(prefix + "Request is an module request.");
  18. if(request.directory) log(prefix + "Request is a directory request.");
  19. if(request.query) log(prefix + "Resolving request query: " + request.query);
  20. if(request.descriptionFilePath) log(prefix + "Has description data from " + request.descriptionFilePath);
  21. if(request.relativePath) log(prefix + "Relative path from description file is: " + request.relativePath);
  22. callback();
  23. });
  24. };