Wikia


//
includer.moduleIncluded(1);
////////////////////////////////////////////////////////////////////////////////////////////////////
// Module: Track
// This module is used to write information to the console that can be used to trace this program.
//
// Dependencies
// These files shall be included before this file is included:
// - Utilities
////////////////////////////////////////////////////////////////////////////////////////////////////

/***************************************************************************************************
User-Defined Object: Track
***************************************************************************************************/
function Track(logEnter, logLeave, logOther) {
  var mLogEnter;
  var mLogLeave;
  var mLogOther;
  /*------------------------------------------------------------------------------------------------
  Publications:                                                                                  */
  this.enter = enter;
  this.leave = leave;
  this.log = log;
  this.setAll = setAll;
  this.setEnter = setEnter;
  this.setLeave = setLeave;
  this.setLog = setLog;
  /*----------------------------------------------------------------------------------------------*/
  function enter(name) {
    if (mLogEnter) {
      write('Entering ' + name + '".');
    }
  }
  /*----------------------------------------------------------------------------------------------*/
  function leave(name) {
    if (mLogLeave) {
      write('Leaving ' + name + '".');
    }
  }
  /*----------------------------------------------------------------------------------------------*/
  function log(message) {
    if (mLogOther) write(message);
  }
  /*----------------------------------------------------------------------------------------------*/
  function setAll(logEnter, logLeave, logOther) {
    assert('setAll01', true, logEnter === true || logEnter === false);
    assert('setAll02', true, logLeave === true || logLeave === false);
    assert('setAll03', true, logOther === true || logOther === false);
    if ((mLogEnter == null || !mLogEnter) &&  logEnter) {
      write('Logging of entering functions is enabled.');
    }
    if ((mLogEnter == null || mLogEnter) &&  !logEnter) {
      write('Logging of entering functions is disabled.');
    }
    if ((mLogLeave == null || !mLogLeave) &&  logLeave) {
      write('Logging of leaving functions is enabled.');
    }
    if ((mLogLeave == null || mLogLeave) &&  !logLeave) {
      write('Logging of leaving functions is disabled.');
    }
    if ((mLogOther == null || !mLogOther) &&  logOther) {
      write('Logging of other messages is enabled.');
    }
    if ((mLogOther == null || mLogOther) &&  !logOther) {
      write('Logging of other messages is disabled.');
    }
  }
  /*----------------------------------------------------------------------------------------------*/
  function setEnter(logEnter) {
    mLogEnter = logEnter;
  }
  /*----------------------------------------------------------------------------------------------*/
  function setLeave(logLeave) {
    mLogLeave = logLeave;
  }
  /*----------------------------------------------------------------------------------------------*/
  function setLog(logOther) {
    mLogOther = logOther;
  }
  /*----------------------------------------------------------------------------------------------*/
  function write(message) {
    var now = new Date();
    console.log(now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() + '.' +
      now.getMilliseconds() + " "  + message);
  }
  /*----------------------------------------------------------------------------------------------*/
  setAll(logEnter, logLeave, logOther);
}
var track = new Track(true, true, true);
//

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Around Wikia's network

Random Wiki