Update of
/var/cvs/Geeklog-2.x/Geeklog-2.x/public_html/javascript/yui/
build/logger
In directory
iowaoutdoors:/tmp/cvs-serv1134/public_html/javascript/yui/bu
ild/logger
Added Files:
README logger-debug.js logger-min.js logger.js
Log Message:
Initial Import
--- NEW FILE: README ---
Logger Release Notes
*** version 0.11.0 ***
* Initial release
--- NEW FILE: logger-debug.js ---
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://dev
eloper.yahoo.net/yui/license.txt
version: 0.11.0
*/
/***********************************************************
*****************/
/***********************************************************
*****************/
/***********************************************************
*****************/
/**
* Singleton providing core logging functionality. Saves
logs written through the
* global YAHOO.log function or written by LogWriter.
Provides access to logs
* for reading by LogReader. Log messages are automatically
output to Firebug,
* if present.
*
* requires YAHOO.util.Event Event utility
*/
YAHOO.widget.Logger = {
[...1147 lines suppressed...]
};
/**
* Handles Logger's onNewEvent.
*
* param type The click event
* param args Data passed from event firer
* param oSelf The log reader instance
* private
*/
YAHOO.widget.LogReader.prototype._onNewLog = function(type,
args, oSelf) {
var logEntry = args[0];
oSelf._buffer.push(logEntry);
if (oSelf.logReaderEnabled === true &&
oSelf._timeout === null) {
oSelf._timeout =
setTimeout(function(){oSelf._printBuffer();}, 100);
}
};
--- NEW FILE: logger.js ---
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://dev
eloper.yahoo.net/yui/license.txt
version: 0.11.0
*/
/***********************************************************
*****************/
/***********************************************************
*****************/
/***********************************************************
*****************/
/**
* Singleton providing core logging functionality. Saves
logs written through the
* global YAHOO.log function or written by LogWriter.
Provides access to logs
* for reading by LogReader. Log messages are automatically
output to Firebug,
* if present.
*
* requires YAHOO.util.Event Event utility
*/
YAHOO.widget.Logger = {
[...1147 lines suppressed...]
};
/**
* Handles Logger's onNewEvent.
*
* param type The click event
* param args Data passed from event firer
* param oSelf The log reader instance
* private
*/
YAHOO.widget.LogReader.prototype._onNewLog = function(type,
args, oSelf) {
var logEntry = args[0];
oSelf._buffer.push(logEntry);
if (oSelf.logReaderEnabled === true &&
oSelf._timeout === null) {
oSelf._timeout =
setTimeout(function(){oSelf._printBuffer();}, 100);
}
};
--- NEW FILE: logger-min.js ---
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://dev
eloper.yahoo.net/yui/license.txt
version: 0.11.0
*/
YAHOO.widget.Logger={loggerEnabled:true,_firebugEnabled:true
,categories:["info","warn","er
ror","time","window"],sources:
["global"],_stack:[],_startTime:new
Date().getTime(),_lastTime:null};YAHOO.widget.Logger.categor
yCreateEvent=new
YAHOO.util.CustomEvent("categoryCreate",this,tru
e);YAHOO.widget.Logger.sourceCreateEvent=new
YAHOO.util.CustomEvent("sourceCreate",this,true)
;YAHOO.widget.Logger.newLogEvent=new
YAHOO.util.CustomEvent("newLog",this,true);YAHOO
.widget.Logger.logResetEvent=new
YAHOO.util.CustomEvent("logReset",this,true);YAH
OO.widget.Logger.log=function(sMsg,sCategory,sSource){if(thi
s.loggerEnabled){if(!sCategory){sCategory="info"
;}
else
if(this._isNewCategory(sCategory)){this._createNewCategory(s
Category);}
var sClass="global";var
sDetail=null;if(sSource){var
spaceIndex=sSource.indexOf("
");if(spaceIndex>0){sClass=sSource.substring(0,spac
eIndex);sDetail=sSource.substring(spaceIndex,sSource.length)
;}
else{sClass=sSource;}
if(this._isNewSource(sClass)){this._createNewSource(sClass);
}}
var timestamp=new Date();var
logEntry={time:timestamp,category:sCategory,source:sClass,so
urceDetail:sDetail,msg:sMsg};this._stack.push(logEntry);this
.newLogEvent.fire(logEntry);if(this._firebugEnabled){this._p
rintToFirebug(logEntry);}
return true;}
else{return
false;}};YAHOO.widget.Logger.reset=function(){this._stack=[]
;this._startTime=new
Date().getTime();this.loggerEnabled=true;this.log(null,&quo
t;Logger
reset");this.logResetEvent.fire();};YAHOO.widget.Logge
r.getStack=function(){return
this._stack;};YAHOO.widget.Logger.getStartTime=function(){re
turn
this._startTime;};YAHOO.widget.Logger.disableFirebug=functio
n(){YAHOO.log("YAHOO.Logger output to Firebug has been
disabled.");this._firebugEnabled=false;};YAHOO.widget.
Logger.enableFirebug=function(){this._firebugEnabled=true;YA
HOO.log("YAHOO.Logger output to Firebug has been
enabled.");};YAHOO.widget.Logger._createNewCategory=fu
nction(category){this.categories.push(category);this.categor
yCreateEvent.fire(category);};YAHOO.widget.Logger._isNewCate
gory=function(category){for(var
i=0;i<this.categories.length;i++){if(category==this.categ
ories[i]){return false;}}
return
true;};YAHOO.widget.Logger._createNewSource=function(source)
{this.sources.push(source);this.sourceCreateEvent.fire(sourc
e);};YAHOO.widget.Logger._isNewSource=function(source){if(so
urce){for(var
i=0;i<this.sources.length;i++){if(source==this.sources[i]
){return false;}}
return
true;}};YAHOO.widget.Logger._printToFirebug=function(entry){
if(window.console&&console.log){var
category=entry.category;var
label=entry.category.substring(0,4).toUpperCase();var
time=entry.time;if(time.toLocaleTimeString){var
localTime=time.toLocaleTimeString();}
else{localTime=time.toString();}
var msecs=time.getTime();var
elapsedTime=(YAHOO.widget.Logger._lastTime)?(msecs-YAHOO.wid
get.Logger._lastTime):0;YAHOO.widget.Logger._lastTime=msecs;
var output=localTime+" ("+
elapsedTime+"ms): "+
entry.source+": "+
entry.msg;console.log(output);}};YAHOO.widget.Logger._onWind
owError=function(msg,url,line){try{YAHOO.widget.Logger.log(m
sg+' ('+url+', line
'+line+')',"window");if(YAHOO.widget.Logger._
origOnWindowError){YAHOO.widget.Logger._origOnWindowError();
}}
catch(e){return
false;}};if(window.onerror){YAHOO.widget.Logger._origOnWindo
wError=window.onerror;}
window.onerror=YAHOO.widget.Logger._onWindowError;YAHOO.widg
et.Logger.log("Logger
initialized");YAHOO.widget.LogWriter=function(sSource)
{if(!sSource){YAHOO.log("Could not instantiate
LogWriter due to invalid
source.","error","LogWriter");
return;}
this._source=sSource;};YAHOO.widget.LogWriter.prototype.toSt
ring=function(){return"LogWriter
"+this._sSource;};YAHOO.widget.LogWriter.prototype.log
=function(sMsg,sCategory){YAHOO.widget.Logger.log(sMsg,sCate
gory,this._source);};YAHOO.widget.LogWriter.prototype.getSou
rce=function(){return
this._sSource;};YAHOO.widget.LogWriter.prototype.setSource=f
unction(sSource){if(!sSource){YAHOO.log("Could not set
source due to invalid
source.","error",this.toString());return;}
else{this._sSource=sSource;}};YAHOO.widget.LogWriter.prototy
pe._source=null;YAHOO.widget.LogReader=function(containerEl,
oConfig){var oSelf=this;if(typeof
oConfig=="object"){for(var param in
oConfig){this[param]=oConfig[param];}}
if(containerEl){if(typeof
containerEl=="string"){this._containerEl=documen
t.getElementById(containerEl);}
else if(containerEl.tagName){this._containerEl=containerEl;}
this._containerEl.className="yui-log";}
if(!this._containerEl){if(YAHOO.widget.LogReader._defaultCon
tainerEl){this._containerEl=YAHOO.widget.LogReader._defaultC
ontainerEl;}
else{this._containerEl=document.body.appendChild(document.cr
eateElement("div"));this._containerEl.id="
yui-log";this._containerEl.className="yui-log&q
uot;;YAHOO.widget.LogReader._defaultContainerEl=this._contai
nerEl;}
var
containerStyle=this._containerEl.style;if(this.width){contai
nerStyle.width=this.width;}
if(this.left){containerStyle.left=this.left;}
if(this.right){containerStyle.right=this.right;}
if(this.bottom){containerStyle.bottom=this.bottom;}
if(this.top){containerStyle.top=this.top;}
if(this.fontSize){containerStyle.fontSize=this.fontSize;}}
if(this._containerEl){if(!this._hdEl){this._hdEl=this._conta
inerEl.appendChild(document.createElement("div")
);this._hdEl.id="yui-log-hd"+YAHOO.widget.LogRea
der._index;this._hdEl.className="yui-log-hd";thi
s._collapseEl=this._hdEl.appendChild(document.createElement(
"div"));this._collapseEl.className="yui-lo
g-btns";this._collapseBtn=document.createElement(&quo
t;input");this._collapseBtn.type="button";
this._collapseBtn.style.fontSize=YAHOO.util.Dom.getStyle(thi
s._containerEl,"fontSize");this._collapseBtn.cla
ssName="yui-log-button";this._collapseBtn.value=
"Collapse";this._collapseBtn=this._collapseEl.ap
pendChild(this._collapseBtn);YAHOO.util.Event.addListener(oS
elf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);
this._title=this._hdEl.appendChild(document.createElement(&
quot;h4"));this._title.innerHTML="Logger
Console";if(YAHOO.util.DD&&(YAHOO.widget.LogRe
ader._defaultContainerEl==this._containerEl)){var
ylog_dd=new
YAHOO.util.DD(this._containerEl.id);ylog_dd.setHandleElId(th
is._hdEl.
id);this._hdEl.style.cursor="move";}}
if(!this._consoleEl){this._consoleEl=this._containerEl.appen
dChild(document.createElement("div"));this._cons
oleEl.className="yui-log-bd";if(this.height){thi
s._consoleEl.style.height=this.height;}}
if(!this._ftEl&&this.footerEnabled){this._ftEl=this.
_containerEl.appendChild(document.createElement("div&
quot;));this._ftEl.className="yui-log-ft";this._
btnsEl=this._ftEl.appendChild(document.createElement("
div"));this._btnsEl.className="yui-log-btns&quo
t;;this._pauseBtn=document.createElement("input"
);this._pauseBtn.type="button";this._pauseBtn.st
yle.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,&quo
t;fontSize");this._pauseBtn.className="yui-log-b
utton";this._pauseBtn.value="Pause";this._
pauseBtn=this._btnsEl.appendChild(this._pauseBtn);YAHOO.util
.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickP
auseBtn,oSelf);this._clearBtn=document.createElement("
input");this._clearBtn.type="button";this.
_clearBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._conta
inerEl,"fontSize");this._clearBtn.className=&qu
ot;yui-log-button";this._clearBtn.value="Clear&
quot;;this._clearBtn=this._btnsEl.appendChild(this._clearBtn
);YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSe
lf._onClickClearBtn,oSelf);thi
s._categoryFiltersEl=this._ftEl.appendChild(document.create
Element("div"));this._categoryFiltersEl.classNam
e="yui-log-categoryfilters";this._sourceFiltersE
l=this._ftEl.appendChild(document.createElement("div&
quot;));this._sourceFiltersEl.className="yui-log-sourc
efilters";}}
if(!this._buffer){this._buffer=[];}
YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog,thi
s);this._lastTime=YAHOO.widget.Logger.getStartTime();this._c
ategoryFilters=[];var
catsLen=YAHOO.widget.Logger.categories.length;if(this._categ
oryFiltersEl){for(var
i=0;i<catsLen;i++){this._createCategoryCheckbox(YAHOO.wid
get.Logger.categories[i]);}}
this._sourceFilters=[];var
sourcesLen=YAHOO.widget.Logger.sources.length;if(this._sourc
eFiltersEl){for(var
j=0;j<sourcesLen;j++){this._createSourceCheckbox(YAHOO.wi
dget.Logger.sources[j]);}}
YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCa
tegoryCreate,this);YAHOO.widget.Logger.sourceCreateEvent.sub
scribe(this._onSourceCreate,this);YAHOO.widget.LogReader._in
dex++;this._filterLogs();};YAHOO.widget.LogReader.prototype.
logReaderEnabled=true;YAHOO.widget.LogReader.prototype.width
=null;YAHOO.widget.LogReader.prototype.height=null;YAHOO.wid
get.LogReader.prototype.top=null;YAHOO.widget.LogReader.prot
otype.left=null;YAHOO.widget.LogReader.prototype.right=null;
YAHOO.widget.LogReader.prototype.bottom=null;YAHOO.widget.Lo
gReader.prototype.fontSize=null;YAHOO.widget.LogReader.proto
type.footerEnabled=true;YAHOO.widget.LogReader.prototype.ver
boseOutput=true;YAHOO.widget.LogReader.prototype.newestOnTop
=true;YAHOO.widget.LogReader.prototype.pause=function(){this
._timeout=null;this.logReaderEnabled=false;};YAHOO.widget.Lo
gReader.prototype.resume=function(){this.logReaderEnabled=tr
ue;this._printBuffer();};YAHOO.widget.LogReader.prototype.hi
de=function(){this._containerE
l.style.display="none";};YAHOO.widget.LogReader
.prototype.show=function(){this._containerEl.style.display=
"block";};YAHOO.widget.LogReader.prototype.setTit
le=function(sTitle){var
regEx=/>/g;sTitle=sTitle.replace(regEx,">&q
uot;);regEx=/</g;sTitle=sTitle.replace(regEx,"&
lt;");this._title.innerHTML=(sTitle);};YAHOO.widget.Lo
gReader._index=0;YAHOO.widget.LogReader._defaultContainerEl=
null;YAHOO.widget.LogReader.prototype._buffer=null;YAHOO.wid
get.LogReader.prototype._lastTime=null;YAHOO.widget.LogReade
r.prototype._timeout=null;YAHOO.widget.LogReader.prototype._
categoryFilters=null;YAHOO.widget.LogReader.prototype._sourc
eFilters=null;YAHOO.widget.LogReader.prototype._containerEl=
null;YAHOO.widget.LogReader.prototype._hdEl=null;YAHOO.widge
t.LogReader.prototype._collapseEl=null;YAHOO.widget.LogReade
r.prototype._collapseBtn=null;YAHOO.widget.LogReader.prototy
pe._title=null;YAHOO.widget.LogReader.prototype._consoleEl=n
ull;YAHOO.widget.LogReader.prototype._ftEl=null;YAHOO.widget
.LogRead
er.prototype._btnsEl=null;YAHOO.widget.LogReader.prototype.
_categoryFiltersEl=null;YAHOO.widget.LogReader.prototype._so
urceFiltersEl=null;YAHOO.widget.LogReader.prototype._pauseBt
n=null;YAHOO.widget.LogReader.prototype._clearBtn=null;YAHOO
.widget.LogReader.prototype._createCategoryCheckbox=function
(category){var oSelf=this;if(this._ftEl){var
parentEl=this._categoryFiltersEl;var
filters=this._categoryFilters;var
filterEl=parentEl.appendChild(document.createElement("
span"));filterEl.className="yui-log-filtergrp&q
uot;;var
categoryChk=document.createElement("input");cate
goryChk.id="yui-log-filter-"+category+YAHOO.widg
et.LogReader._index;categoryChk.className="yui-log-fil
ter-"+category;categoryChk.type="checkbox"
;categoryChk.category=category;categoryChk=filterEl.appendCh
ild(categoryChk);categoryChk.checked=true;filters.push(categ
ory);YAHOO.util.Event.addListener(categoryChk,'click',oSel
f._onCheckCategory,oSelf);var
categoryChkLbl=filterEl.appendChild(document.createElement(
"label"));
categoryChkLbl.htmlFor=categoryChk.id;categoryChkLbl.classN
ame=category;categoryChkLbl.innerHTML=category;}};YAHOO.widg
et.LogReader.prototype._createSourceCheckbox=function(source
){var oSelf=this;if(this._ftEl){var
parentEl=this._sourceFiltersEl;var
filters=this._sourceFilters;var
filterEl=parentEl.appendChild(document.createElement("
span"));filterEl.className="yui-log-filtergrp&q
uot;;var
sourceChk=document.createElement("input");source
Chk.id="yui-log-filter"+source+YAHOO.widget.LogR
eader._index;sourceChk.className="yui-log-filter"
;+source;sourceChk.type="checkbox";sourceChk.sou
rce=source;sourceChk=filterEl.appendChild(sourceChk);sourceC
hk.checked=true;filters.push(source);YAHOO.util.Event.addLis
tener(sourceChk,'click',oSelf._onCheckSource,oSelf);var
sourceChkLbl=filterEl.appendChild(document.createElement(&q
uot;label"));sourceChkLbl.htmlFor=sourceChk.id;sourceC
hkLbl.className=source;sourceChkLbl.innerHTML=source;}};YAHO
O.widget.LogReader.prototype._filterLogs=function(){if(this.
_conso
leEl!==null){this._clearConsole();this._printToConsole(YAHO
O.widget.Logger.getStack());}};YAHOO.widget.LogReader.protot
ype._clearConsole=function(){this._timeout=null;this._buffer
=[];this._lastTime=YAHOO.widget.Logger.getStartTime();var
consoleEl=this._consoleEl;while(consoleEl.hasChildNodes()){c
onsoleEl.removeChild(consoleEl.firstChild);}};YAHOO.widget.L
ogReader.prototype._printBuffer=function(){this._timeout=nul
l;if(this._consoleEl!==null){var entries=[];for(var
i=0;i<this._buffer.length;i++){entries[i]=this._buffer[i]
;}
this._buffer=[];this._printToConsole(entries);if(!this.newes
tOnTop){this._consoleEl.scrollTop=this._consoleEl.scrollHeig
ht;}}};YAHOO.widget.LogReader.prototype._printToConsole=func
tion(aEntries){var entriesLen=aEntries.length;var
sourceFiltersLen=this._sourceFilters.length;var
categoryFiltersLen=this._categoryFilters.length;for(var
i=0;i<entriesLen;i++){var entry=aEntries[i];var
category=entry.category;var source=entry.source;var
sourceDetail=entry.sourceDetail;var okToPrint=false;var
okToFilterCats=false;for(var
j=0;j<sourceFiltersLen;j++){if(source==this._sourceFilter
s[j]){okToFilterCats=true;break;}}
if(okToFilterCats){for(var
k=0;k<categoryFiltersLen;k++){if(category==this._category
Filters[k]){okToPrint=true;break;}}}
if(okToPrint){var
label=entry.category.substring(0,4).toUpperCase();var
time=entry.time;if(time.toLocaleTimeString){var
localTime=time.toLocaleTimeString();}
else{localTime=time.toString();}
var msecs=time.getTime();var
startTime=YAHOO.widget.Logger.getStartTime();var
totalTime=msecs-startTime;var
elapsedTime=msecs-this._lastTime;this._lastTime=msecs;var
verboseOutput=(this.verboseOutput)?"<br>":
"";var
sourceAndDetail=(sourceDetail)?source+"
"+sourceDetail:source;var output="<span
class='"+category+"'>"+label+"&
lt;/span> "+
totalTime+"ms (+"+
elapsedTime+") "+localTime+": "+
sourceAndDetail+": "+
verboseOutput+
entry.msg;var
oNewElement=(this.newestOnTop)?this._consoleEl.insertBefore(
document.createElement("p"),this._consoleEl.firs
tChild):this._consoleEl.appendChild(document.createElement(
"p"));oNewElement.innerHTML=output;}}};YAHOO.widg
et.LogReader.prototype._onCategoryCreate=function(type,args,
oSelf){var
category=args[0];if(oSelf._ftEl){oSelf._createCategoryCheckb
ox(category);}};YAHOO.widget.LogReader.prototype._onSourceCr
eate=function(type,args,oSelf){var
source=args[0];if(oSelf._ftEl){oSelf._createSourceCheckbox(s
ource);}};YAHOO.widget.LogReader.prototype._onCheckCategory=
function(v,oSelf){var newFilter=this.category;var
filtersArray=oSelf._categoryFilters;if(!this.checked){for(va
r
i=0;i<filtersArray.length;i++){if(newFilter==filtersArray
[i]){filtersArray.splice(i,1);break;}}}
else{filtersArray.push(newFilter);}
oSelf._filterLogs();};YAHOO.widget.LogReader.prototype._onCh
eckSource=function(v,oSelf){var newFilter=this.source;var
filtersArray=oSelf._sourceFilters;if(!this.checked){for(var
i=0;i<filtersArray.length;i++){if(newFilter==filtersArray
[i]){filtersArray.splice(i,1);break;}}}
else{filtersArray.push(newFilter);}
oSelf._filterLogs();};YAHOO.widget.LogReader.prototype._onCl
ickCollapseBtn=function(v,oSelf){var
btn=oSelf._collapseBtn;if(btn.value=="Expand"){o
Self._consoleEl.style.display="block";if(oSelf._
ftEl){oSelf._ftEl.style.display="block";}
btn.value="Collapse";}
else{oSelf._consoleEl.style.display="none";if(oS
elf._ftEl){oSelf._ftEl.style.display="none";}
btn.value="Expand";}};YAHOO.widget.LogReader.pro
totype._onClickPauseBtn=function(v,oSelf){var
btn=oSelf._pauseBtn;if(btn.value=="Resume"){oSel
f.resume();btn.value="Pause";}
else{oSelf.pause();btn.value="Resume";}};YAHOO.w
idget.LogReader.prototype._onClickClearBtn=function(v,oSelf)
{oSelf._clearConsole();};YAHOO.widget.LogReader.prototype._o
nNewLog=function(type,args,oSelf){var
logEntry=args[0];oSelf._buffer.push(logEntry);if(oSelf.logRe
aderEnabled===true&&oSelf._timeout===null){oSelf._ti
meout=setTimeout(function(){oSelf._printBuffer();},100);}};
_______________________________________________
geeklog2-cvs mailing list
geeklog2-cvs lists.geeklog.net
http://lists.geeklog.net/mailman/listinfo/geeklog2-cvs
|