Sha256: ef804f1c0d6fabe04915b05a3e1bc817b8ea0c7eb115e9b8b0997b8d2741288a

Contents?: true

Size: 1.62 KB

Versions: 11

Compression:

Stored size: 1.62 KB

Contents

// Copyright 2005-2006 Google
//
// Author: Steffen Meschkat <mesch@google.com>
//
// A very simple logging facility, used in test/xpath.html.

var logging__ = true;

function Log() {};

Log.lines = [];

Log.write = function(s) {
  if (logging__) {
    this.lines.push(xmlEscapeText(s));
    this.show();
  }
};

// Writes the given XML with every tag on a new line.
Log.writeXML = function(xml) {
  if (logging__) {
    var s0 = xml.replace(/</g, '\n<');
    var s1 = xmlEscapeText(s0);
    var s2 = s1.replace(/\s*\n(\s|\n)*/g, '<br/>');
    this.lines.push(s2);
    this.show();
  }
}

// Writes without any escaping
Log.writeRaw = function(s) {
  if (logging__) {
    this.lines.push(s);
    this.show();
  }
}

Log.clear = function() {
  if (logging__) {
    var l = this.div();
    l.innerHTML = '';
    this.lines = [];
  }
}

Log.show = function() {
  var l = this.div();
  l.innerHTML += this.lines.join('<br/>') + '<br/>';
  this.lines = [];
  l.scrollTop = l.scrollHeight;
}

Log.div = function() {
  var l = document.getElementById('log');
  if (!l) {
    l = document.createElement('div');
    l.id = 'log';
    l.style.position = 'absolute';
    l.style.right = '5px';
    l.style.top = '5px';
    l.style.width = '250px';
    l.style.height = '150px';
    l.style.overflow = 'auto';
    l.style.backgroundColor = '#f0f0f0';
    l.style.border = '1px solid gray';
    l.style.fontSize = '10px';
    l.style.padding = '5px';
    document.body.appendChild(l);
  }
  return l;
}

// Reimplement the log functions from util.js to use the simple log.
function xpathLog(msg) {
  Log.write(msg);
};
function xsltLog(msg) {};
function xsltLogXml(msg) {};

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
envjs19-0.3.8.20101029121421 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.8 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.7 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.6 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.5 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.4 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.3 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.2 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.1 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.3.0 src/xslt/ajaxslt-0.8.1/simplelog.js
envjs-0.2.0 src/xslt/ajaxslt-0.8.1/simplelog.js