<commit_before>
var debug            = require('debug');
var multimatch       = require('multimatch');
var util             = require('util');


var debugSource      = debug('metalsmith:source');
var debugDestination = debug('metalsmith:destination');
var debugMetadata    = debug('metalsmith:metadata');
var debugFiles       = debug('metalsmith:files');
var debugLog         = debug('metalsmith:log');


/**
 * For consistency with `debug` module
 */

var useColors = debug.useColors();

function inspect(obj) {
  return '\n' + util.inspect(obj, {colors: useColors});
}


/**
 * A Metalsmith plugin to debug Metalsmith and plugins.
 *
 * @return {Function}
 */

module.exports = function plugin(options) {
  options = (options === undefined) ? {} : options;
  options.metadata = (options.metadata === undefined) ?
                     true : options.metadata;
  options.source = (options.source === undefined) ?
                   true : options.source;
  options.destination = (options.destination === undefined) ?
                        true : options.destination;
  options.files = (options.files === undefined) ? true : options.files;
  options.match = (options.match === undefined) ? '' : options.match;
  options.log = (options.log === undefined) ? false : options.log;


  return function(files, metalsmith, done) {

    if (process.env.DEBUG) {
      console.log('  metalsmith-debug: ' +
                  'namespaces set to DEBUG=%s', process.env.DEBUG);
    }
    else {
      console.log('  metalsmith-debug: ' +
                  'no namespaces are set in DEBUG environment');
      console.log('  metalsmith-debug: ' +
                  'set DEBUG=metalsmith:* for all namespaces');
    }

    if (options.log) {
      debugLog('"%s"', options.log);
    }

    if (options.source) {
      debugSource('"%s"', metalsmith.source());
    }

    if (options.destination) {
      debugDestination('"%s"', metalsmith.destination());
    }

    if (options.metadata) {
      debugMetadata(inspect(metalsmith.metadata()));
    }


    var files2log = {};

    if (options.match.length) {
      Object.keys(files).forEach(function(file){
        if (multimatch(file, options.match).length) {
          files2log[file] = files[file];
        }
      });
    } else {
      files2log = files;
    }

    if (options.files) {
      debugFiles(inspect(files2log));
    }

    done();
  };
};
<commit_msg>make module silent by default again<commit_after>
var debug            = require('debug');
var multimatch       = require('multimatch');
var util             = require('util');


var debugSource      = debug('metalsmith:source');
var debugDestination = debug('metalsmith:destination');
var debugMetadata    = debug('metalsmith:metadata');
var debugFiles       = debug('metalsmith:files');
var debugLog         = debug('metalsmith:log');


/**
 * For consistency with `debug` module
 */

var useColors = debug.useColors();

function inspect(obj) {
  return '\n' + util.inspect(obj, {colors: useColors});
}


/**
 * A Metalsmith plugin to debug Metalsmith and plugins.
 *
 * @return {Function}
 */

module.exports = function plugin(options) {
  options = (options === undefined) ? {} : options;
  options.metadata = (options.metadata === undefined) ?
                     true : options.metadata;
  options.source = (options.source === undefined) ?
                   true : options.source;
  options.destination = (options.destination === undefined) ?
                        true : options.destination;
  options.files = (options.files === undefined) ? true : options.files;
  options.match = (options.match === undefined) ? '' : options.match;
  options.log = (options.log === undefined) ? false : options.log;


  return function(files, metalsmith, done) {

    if (options.log) {
      debugLog('"%s"', options.log);
    }

    if (options.source) {
      debugSource('"%s"', metalsmith.source());
    }

    if (options.destination) {
      debugDestination('"%s"', metalsmith.destination());
    }

    if (options.metadata) {
      debugMetadata(inspect(metalsmith.metadata()));
    }


    var files2log = {};

    if (options.match.length) {
      Object.keys(files).forEach(function(file){
        if (multimatch(file, options.match).length) {
          files2log[file] = files[file];
        }
      });
    } else {
      files2log = files;
    }

    if (options.files) {
      debugFiles(inspect(files2log));
    }

    done();
  };
};

{'fraction_non_alphanumeric': 0.1506172839506173, 'fraction_numerical': 0.0017957351290684624, 'mean_word_length': 2.670510708401977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1397821', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1289, 'n_words': 275}