lib/core/brokenLinkChecker.js
function BrokenLinkChecker(options) {
  this.runningScope = options.scope || BrokenLinkChecker.RUNNING_SCOPE_COMMAND;
  this.pluginConfig = {};
  this.pluginConfig.enabled = (typeof userConfig.enabled !== 'undefined')? userConfig.enabled : true;
  this.pluginConfig.storageDir = userConfig.storage_dir || 'temp/link_checker';
  this.pluginConfig.silentLogs = options.silentLogs || userConfig.silent_logs || false;

  this.workingDirectory = hexo.base_dir + this.pluginConfig.storageDir;

  this.storageFile = 'data.json';
  this.logFile = 'log.json';
  this._storageTemplateFile = __dirname + '/../data/storageTemplate.json';
  this._jsonStorage = null;

  // the path must end with a slash
  if (this.workingDirectory.substr(-1) != '/') {
    this.workingDirectory += '/';
  }

  var loggerOptions = {
    defaultPrefix: null,
    infoPrefix: null,
    warnPrefix: null,
    errPrefix: null,
    silent: this.pluginConfig.silentLogs,
    logFile: this.workingDirectory+this.logFile
  };

  // change the log prefix based on the running scope
  // command:
  //    (i) Text
  // filter:
  //    [BrokenLinkChecker Info] Text
  switch (this.runningScope) {
    case BrokenLinkChecker.RUNNING_SCOPE_COMMAND:
      loggerOptions.defaultPrefix = '(i) '.cyan;
      loggerOptions.warnPrefix = '(!) '.yellow;
      loggerOptions.errPrefix = '(x) '.red;
      break;
    case BrokenLinkChecker.RUNNING_SCOPE_FILTER:
      loggerOptions.defaultPrefix = '['+(this.toString()+' Info').cyan+'] ';
      loggerOptions.warnPrefix = '['+(this.toString()+' Warning').yellow+'] ';
      loggerOptions.errPrefix = '['+(this.toString()+' Error').red+'] ';
      break;
  }

  this.logger = new Logger(loggerOptions);
}
function BrokenLinkChecker(options) {
  this.runningScope = options.scope || BrokenLinkChecker.RUNNING_SCOPE_COMMAND;
  this.pluginConfig = {};
  this.pluginConfig.enabled = (typeof userConfig.enabled !== 'undefined')? userConfig.enabled : true;
  this.pluginConfig.storageDir = userConfig.storage_dir || 'temp/link_checker';
  this.pluginConfig.silentLogs = options.silentLogs || userConfig.silent_logs || false;

  this.workingDirectory = hexo.base_dir + this.pluginConfig.storageDir;

  this.storageFile = 'data.json';
  this.logFile = 'log.json';
  this._storageTemplateFile = __dirname + '/../data/storageTemplate.json';
  this._jsonStorage = null;

  // the path must end with a slash
  if (this.workingDirectory.substr(-1) != '/') {
    this.workingDirectory += '/';
  }

  var loggerOptions = {
    defaultPrefix: null,
    infoPrefix: null,
    warnPrefix: null,
    errPrefix: null,
    silent: this.pluginConfig.silentLogs,
    logFile: this.workingDirectory+this.logFile
  };

  // change the log prefix based on the running scope
  // command:
  //    (i) Text
  // filter:
  //    [BrokenLinkChecker Info] Text
  switch (this.runningScope) {
    case BrokenLinkChecker.RUNNING_SCOPE_COMMAND:
      loggerOptions.defaultPrefix = '(i) '.cyan;
      loggerOptions.warnPrefix = '(!) '.yellow;
      loggerOptions.errPrefix = '(x) '.red;
      break;
    case BrokenLinkChecker.RUNNING_SCOPE_FILTER:
      loggerOptions.defaultPrefix = '['+(this.toString()+' Info').cyan+'] ';
      loggerOptions.warnPrefix = '['+(this.toString()+' Warning').yellow+'] ';
      loggerOptions.errPrefix = '['+(this.toString()+' Error').red+'] ';
      break;
  }

  this.logger = new Logger(loggerOptions);
}
function BrokenLinkChecker ( options ) { this . runningScope = options . scope || BrokenLinkChecker . RUNNING_SCOPE_COMMAND ; this . pluginConfig = { } ; this . pluginConfig . enabled = ( typeof userConfig . enabled !== 'undefined' ) ? userConfig . enabled : true ; this . pluginConfig . storageDir = userConfig . storage_dir || 'temp/link_checker' ; this . pluginConfig . silentLogs = options . silentLogs || userConfig . silent_logs || false ; this . workingDirectory = hexo . base_dir + this . pluginConfig . storageDir ; this . storageFile = 'data.json' ; this . logFile = 'log.json' ; this . _storageTemplateFile = __dirname + '/../data/storageTemplate.json' ; this . _jsonStorage = null ; // the path must end with a slash if ( this . workingDirectory . substr ( - 1 ) != '/' ) { this . workingDirectory += '/' ; } var loggerOptions = { defaultPrefix : null , infoPrefix : null , warnPrefix : null , errPrefix : null , silent : this . pluginConfig . silentLogs , logFile : this . workingDirectory + this . logFile } ; // change the log prefix based on the running scope // command: //    (i) Text // filter: //    [BrokenLinkChecker Info] Text switch ( this . runningScope ) { case BrokenLinkChecker . RUNNING_SCOPE_COMMAND : loggerOptions . defaultPrefix = '(i) ' . cyan ; loggerOptions . warnPrefix = '(!) ' . yellow ; loggerOptions . errPrefix = '(x) ' . red ; break ; case BrokenLinkChecker . RUNNING_SCOPE_FILTER : loggerOptions . defaultPrefix = '[' + ( this . toString ( ) + ' Info' ) . cyan + '] ' ; loggerOptions . warnPrefix = '[' + ( this . toString ( ) + ' Warning' ) . yellow + '] ' ; loggerOptions . errPrefix = '[' + ( this . toString ( ) + ' Error' ) . red + '] ' ; break ; } this . logger = new Logger ( loggerOptions ) ; }
BrokenLinkChecker constructor.

Options:
- `scope`: BrokenLinkChecker.RUNNING_SCOPE_*
- `silentLogs`: output all log info to a file, instead
using the stdout.

@class BrokenLinkChecker
@constructor
@param {Object} options
BrokenLinkChecker constructor .