alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/* @author Edward Hieatt, edward@jsunit.net */

function jsUnitTracer() {
  this._traceWindow        = null;
  this.TRACE_LEVEL_WARNING = 1;
  this.TRACE_LEVEL_INFO    = 2;
  this.TRACE_LEVEL_DEBUG   = 3;
  this.popupWindowsBlocked = false;
}

jsUnitTracer.prototype.initialize = function () 
{
  if (this._traceWindow != null && top.testManager.closeTraceWindowOnNewRun.checked)
    this._traceWindow.close();

  this._traceWindow = null;
}

jsUnitTracer.prototype.finalize = function () 
{
  if (this._traceWindow!=null) {
    this._traceWindow.document.write('<\/body>\n<\/html>');
    this._traceWindow.document.close();
  }
}

jsUnitTracer.prototype.warn = function () 
{
  this._trace(arguments[0], arguments[1], this.TRACE_LEVEL_WARNING);
}

jsUnitTracer.prototype.inform = function () 
{
  this._trace(arguments[0], arguments[1], this.TRACE_LEVEL_INFO);
}

jsUnitTracer.prototype.debug = function () 
{
  this._trace(arguments[0], arguments[1], this.TRACE_LEVEL_DEBUG);
}

jsUnitTracer.prototype._trace = function (message, value, traceLevel) 
{
  if (this._getChosenTraceLevel() >= traceLevel) {
    var traceString = message;
    if (value)
      traceString += ': ' + value;
    this._writeToTraceWindow(traceString, traceLevel);
  }
}

jsUnitTracer.prototype._getChosenTraceLevel = function () 
{
  return eval(top.testManager.traceLevel.value);
}

jsUnitTracer.prototype._writeToTraceWindow  = function (traceString, traceLevel) 
{
  var htmlToAppend = '<p class="jsUnitDefault">' + traceString + '<\/p>\n';
  this._getTraceWindow().document.write(htmlToAppend);
}

jsUnitTracer.prototype._getTraceWindow = function () 
{
  if (this._traceWindow == null && !this.popupWindowsBlocked) {
    this._traceWindow = window.open('','','width=600, height=350,status=no,resizable=yes,scrollbars=yes');
    if (!this._traceWindow) {
      this.popupWindowsBlocked = true;
    }
    else {
      var resDoc = this._traceWindow.document;
      resDoc.write('<html>\n\n\nTracing - JsUnit<\/title>\n<head>\n<body>');
      resDoc.write('<h2>Tracing - JsUnit<\/h2>\n');
    }
  }
  return this._traceWindow;
}

if (xbDEBUG.on)
{
  xbDebugTraceObject('window', 'jsUnitTracer');
}

</pre>
</td>
</tr>
</table>
</div>

<div style="padding-top: 1em; width: 310px; margin-left: auto; margin-right: auto; table {border-collapse: collapse; border: none;}; tr {border-collapse: collapse; border: none; text-align: center;};">
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
      <td colspan="2" style="border-collapse: collapse; border: none; text-align: center;};">
        <em>... this post is sponsored by my books ...</em>
      </td>
  </tr>
  <tr>
      <td width="150" style="border-collapse: collapse; border: none; text-align: center;};">
        <a href="https://kbhr.co/ckbk-v2"><img
           src="/images/books/scala-cookbook-v2-cover-220h.jpg"
           title="The Scala Cookbook, by Alvin Alexander" height="220" />
           <br /><span style="opacity: 0.4;">#1 New Release!</span></a>
      </td>
      <td width="150" style="border-collapse: collapse; border: none; text-align: center; padding-left: 8px;">
        <a href="http://kbhr.co/fps-book"><img
           src="/images/books/functional-programming-simplified-small.jpg"
           title="Functional Programming, Simplified, by Alvin Alexander"
           height="220" />
           <br /><span style="opacity: 0.4;">FP Best Seller</span></a>
      </td>
  </tr>
</table>
<p> </p>
</div>


<div id="whats_new">
<h2>new blog posts</h2>
<div id="whats_new_list">
<ul>
<li><a class="whats_new_link" href="/photos/hello-peter-me-your-father-walter-bishop-fringe-funny">Hello Peter, this is me, your father, Walter Bishop</a></li>
<li><a class="whats_new_link" href="/personal/true-christian-voter-guidelines-2024-jesus-quotes-lying-people-who-lie">True Christian Voting, 2024: Quotes from Jesus about lying, and people who lie</a></li>
<li><a class="whats_new_link" href="/personal/dear-fellow-2024-christian-voters-trust-bible-jesus-yourself-russian-swing-states">Dear Fellow 2024 Christian Voters: Trust The Bible, Jesus, and yourself</a></li>
<br/>
<li><a class="whats_new_link" href="/personal/true-christian-voting-2024-fear-going-hell-rapture-ten-commandments-soul">True Christian Voting 2024: Fear of going to Hell, the Rapture, the Ten Commandments, and your soul</a></li>
<li><a class="whats_new_link" href="/photos/christian-voting-2024-liars-heaven-hell-selling-your-soul">Christian voting 2024, liars, heaven, and hell</a></li>
<li><a class="whats_new_link" href="/personal/as-a-christian-will-i-go-to-hell-voting-for-donald-trump-2024">As a Christian, will I go to hell if I vote for Donald Trump in 2024?</a></li>
<br/>
<li><a class="whats_new_link" href="/photos/ai-image-painting-depiction-of-hell-2024-presidential-election">The 2024 Presidential Election, and a painting of hell</a></li>
<li><a class="whats_new_link" href="/personal/dream-notes-october-30-2022-poland-explosion-krakow">Notes from a dream, October 30, 2022 (explosion in Poland)</a></li>
<li><a class="whats_new_link" href="/scala/zio-2-zio-jdbc-examples-sql-insert-drop-select-update-delete">ZIO 2: ZIO JDBC examples (SQL select, insert, drop, update, delete, transactions)</a></li>
<br/>
<br/>
</div>
</ul>
</div>


<p> </p>

<p align="center"><font color="#000000" size="2"
face="Verdana,Arial">Copyright 1998-2024 Alvin Alexander, alvinalexander.com<br/>
All Rights Reserved.<br/>
<br/>
A percentage of advertising revenue from<br/>
pages under the <a href="/java/jwarehouse">/java/jwarehouse</a> 
URI on this website is<br/>
paid back to open source projects.</p>


<script>
shuffle(books);
var div = document.getElementById("leftcol");
var pre = '<div style="margin: 0; padding-right: 1.6em"><h2 align="center">favorite books</h2>';
var post = '</div>';
if (adblock) {
  var str = books.slice(0,3).join(" ");
  div.insertAdjacentHTML('beforeend', pre + str + post);
} else {
  var str = books.slice(0,1).join(" ");
  div.insertAdjacentHTML('beforeend', pre + str + post);
}
</script>

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3075717592179848"
        crossorigin="anonymous"></script>

<p style="padding-bottom: 80px;"> </p>


</body>