client/annotviz/app/js/logger.js
author rougeronj
Fri, 10 Apr 2015 16:45:34 +0200
changeset 145 a8052f8ab19c
parent 131 0bb70072a56f
permissions -rw-r--r--
add range options to scale the scene depending on this range. Add rescale function to rescale the scene when a note is out of this range

/**
* js/wswrapper.js
*
* simple logger service
*
*/

/* global document: false */

'use strict';

function HtmlLogger(doLog, container) {

    var logContainer = container;
    if(typeof(container) === 'string') {
        logContainer = document.getElementById(container);
    }
    if(!doLog) {
        document.body.removeChild(logContainer);
        logContainer = undefined;
    }


    this.log = function(msg) {
        if(doLog && logContainer) {
            logContainer.innerHTML += msg + '\n';
            logContainer.scrollTop = logContainer.scrollHeight;
        }
    };
}

function ConsoleLogger(doLog) {

    this.log = function(msg) {
        if(doLog) {
            console.log(msg);
        }
    };

}

module.exports = {
    HtmlLogger: HtmlLogger,
    ConsoleLogger: ConsoleLogger
};