/[jquery]/jquery/jquery-log.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /jquery/jquery-log.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 30 by dpavlin, Fri Aug 18 11:54:32 2006 UTC revision 32 by dpavlin, Fri Aug 18 13:09:28 2006 UTC
# Line 4  Line 4 
4          2006-08-18 Dobrica Pavlinusic <dpavlin@rot13.org>          2006-08-18 Dobrica Pavlinusic <dpavlin@rot13.org>
5  */  */
6    
7  var _log_count = {  var _log_count;
         info: 0,  
         debug: 0,  
         error: 0  
 };  
8    
9  $.log = {  $.log = {
10    
11            /* semi-private functions */
12    
13          join: function(a) {          join: function(a) {
14                  var m = '';                  var m = '';
15                  for (var i=0; i<a.length; i++)                  for (var i=0; i<a.length; i++)
# Line 18  $.log = { Line 17  $.log = {
17                  return m;                  return m;
18          },          },
19    
   
20          counter: function() {          counter: function() {
21                  $('#debug-counter').html(                  $('#debug-counter').html(
22                          '<span class="log-info">'+_log_count.info+'</span> ' +                          '<span class="log-info">'+_log_count.info+'</span> ' +
# Line 27  $.log = { Line 25  $.log = {
25                  );                  );
26          },          },
27    
28            toggle: function() {
29                    $('#debug').toggle();
30                    $('#debug_show').toggle();
31                    return false;
32            },
33    
34            /* public functions */
35    
36            create: function() {
37    
38                    $('body').append(
39                    '<div id="debug" class="debug">' +
40                    '<a class="hide" href="#" onclick="javascript:return $.log.toggle();">X</a>' +
41                    '</div>' +
42                    '<div id="debug_show" class="debug">' +
43                    '<a class="hide" href="#" onclick="javascript:return $.log.toggle();"><span id="debug-counter">?</span></a>' +
44                    '</div>'
45                    );
46    
47                    _log_count = {
48                            info: 0,
49                            debug: 0,
50                            error: 0
51                    };
52    
53                    this.debug('created logger');
54            },
55    
56          info: function() {          info: function() {
57                  if (arguments) {                  if (arguments) {
58                            if (! _log_count) this.create();
59                          _log_count.info++;                          _log_count.info++;
60                          $('#debug').append( '<div class="log-info">'+this.join(arguments)+'</div>' );                          $('#debug').append( '<div class="log-info">'+this.join(arguments)+'</div>' );
61                          this.counter();                          this.counter();
# Line 36  $.log = { Line 63  $.log = {
63          },          },
64          debug: function() {          debug: function() {
65                  if (arguments) {                  if (arguments) {
66                            if (! _log_count) this.create();
67                          _log_count.debug++;                          _log_count.debug++;
68                          $('#debug').append( '<div class="log-debug">'+this.join(arguments)+'</div>' );                          $('#debug').append( '<div class="log-debug">'+this.join(arguments)+'</div>' );
69                          this.counter();                          this.counter();
# Line 43  $.log = { Line 71  $.log = {
71          },          },
72          error: function() {          error: function() {
73                  if (arguments) {                  if (arguments) {
74                            if (! _log_count) this.create();
75                          _log_count.error++;                          _log_count.error++;
76                          $('#debug').append( '<div class="log-error">'+this.join(arguments)+'</div>' );                          $('#debug').append( '<div class="log-error">'+this.join(arguments)+'</div>' );
77                          this.counter();                          this.counter();
78                  }                  }
79          },          }
80  };  };
81    

Legend:
Removed from v.30  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26