lib/slowlog.js
function SlowLog(conf) {
  this._conf = conf;

  // log commands slower than this number of microseconds
  // disabled by default
  this._slowerThan = -1;

  // maximum length of the slow log
  this._maxLen = 128;

  // set up log records array
  this.reset();

  // log record for the current executing command
  this._record = null;

  function onConfigLoad() {
    this._slowerThan = conf.get(ConfigKey.SLOWLOG_LOG_SLOWER_THAN);
    this._maxLen = conf.get(ConfigKey.SLOWLOG_MAX_LEN);
  }

  function onSlowerThan(key, value) {
    this._slowerThan = value;
  }

  function onMaxLen(key, value) {
    // minimum record length is one, if a user wishes
    // to disable slow logs they should set slowlog-log-slower-than to -1
    this._maxLen = Math.max(value, 1);
  }

  onConfigLoad = onConfigLoad.bind(this);
  onSlowerThan = onSlowerThan.bind(this);
  onMaxLen = onMaxLen.bind(this);

  this._conf.once('load', onConfigLoad.bind(this));

  this._conf.on(ConfigKey.SLOWLOG_LOG_SLOWER_THAN, onSlowerThan);
  this._conf.on(ConfigKey.SLOWLOG_MAX_LEN, onMaxLen);

  // bind stop here as it is called as a before
  // function on the response
  this.stop = this.stop.bind(this);
}
function SlowLog(conf) {
  this._conf = conf;

  // log commands slower than this number of microseconds
  // disabled by default
  this._slowerThan = -1;

  // maximum length of the slow log
  this._maxLen = 128;

  // set up log records array
  this.reset();

  // log record for the current executing command
  this._record = null;

  function onConfigLoad() {
    this._slowerThan = conf.get(ConfigKey.SLOWLOG_LOG_SLOWER_THAN);
    this._maxLen = conf.get(ConfigKey.SLOWLOG_MAX_LEN);
  }

  function onSlowerThan(key, value) {
    this._slowerThan = value;
  }

  function onMaxLen(key, value) {
    // minimum record length is one, if a user wishes
    // to disable slow logs they should set slowlog-log-slower-than to -1
    this._maxLen = Math.max(value, 1);
  }

  onConfigLoad = onConfigLoad.bind(this);
  onSlowerThan = onSlowerThan.bind(this);
  onMaxLen = onMaxLen.bind(this);

  this._conf.once('load', onConfigLoad.bind(this));

  this._conf.on(ConfigKey.SLOWLOG_LOG_SLOWER_THAN, onSlowerThan);
  this._conf.on(ConfigKey.SLOWLOG_MAX_LEN, onMaxLen);

  // bind stop here as it is called as a before
  // function on the response
  this.stop = this.stop.bind(this);
}
function SlowLog ( conf ) { this . _conf = conf ; // log commands slower than this number of microseconds // disabled by default this . _slowerThan = - 1 ; // maximum length of the slow log this . _maxLen = 128 ; // set up log records array this . reset ( ) ; // log record for the current executing command this . _record = null ; function onConfigLoad ( ) { this . _slowerThan = conf . get ( ConfigKey . SLOWLOG_LOG_SLOWER_THAN ) ; this . _maxLen = conf . get ( ConfigKey . SLOWLOG_MAX_LEN ) ; } function onSlowerThan ( key , value ) { this . _slowerThan = value ; } function onMaxLen ( key , value ) { // minimum record length is one, if a user wishes // to disable slow logs they should set slowlog-log-slower-than to -1 this . _maxLen = Math . max ( value , 1 ) ; } onConfigLoad = onConfigLoad . bind ( this ) ; onSlowerThan = onSlowerThan . bind ( this ) ; onMaxLen = onMaxLen . bind ( this ) ; this . _conf . once ( 'load' , onConfigLoad . bind ( this ) ) ; this . _conf . on ( ConfigKey . SLOWLOG_LOG_SLOWER_THAN , onSlowerThan ) ; this . _conf . on ( ConfigKey . SLOWLOG_MAX_LEN , onMaxLen ) ; // bind stop here as it is called as a before // function on the response this . stop = this . stop . bind ( this ) ; }
Encapsulates the slow log queries storage.

@param conf The server configuration.
Encapsulates the slow log queries storage .