Parent Directory | Revision Log
beginning of jquery logging plugin
1 | dpavlin | 30 | /* |
2 | jquery logging plugin | ||
3 | |||
4 | 2006-08-18 Dobrica Pavlinusic <dpavlin@rot13.org> | ||
5 | */ | ||
6 | |||
7 | var _log_count = { | ||
8 | info: 0, | ||
9 | debug: 0, | ||
10 | error: 0 | ||
11 | }; | ||
12 | |||
13 | $.log = { | ||
14 | join: function(a) { | ||
15 | var m = ''; | ||
16 | for (var i=0; i<a.length; i++) | ||
17 | m += a[i] + '<br/>'; | ||
18 | return m; | ||
19 | }, | ||
20 | |||
21 | |||
22 | counter: function() { | ||
23 | $('#debug-counter').html( | ||
24 | '<span class="log-info">'+_log_count.info+'</span> ' + | ||
25 | '<span class="log-debug">'+_log_count.debug+'</span> ' + | ||
26 | '<span class="log-error">'+_log_count.error+'</span>' | ||
27 | ); | ||
28 | }, | ||
29 | |||
30 | info: function() { | ||
31 | if (arguments) { | ||
32 | _log_count.info++; | ||
33 | $('#debug').append( '<div class="log-info">'+this.join(arguments)+'</div>' ); | ||
34 | this.counter(); | ||
35 | } | ||
36 | }, | ||
37 | debug: function() { | ||
38 | if (arguments) { | ||
39 | _log_count.debug++; | ||
40 | $('#debug').append( '<div class="log-debug">'+this.join(arguments)+'</div>' ); | ||
41 | this.counter(); | ||
42 | } | ||
43 | }, | ||
44 | error: function() { | ||
45 | if (arguments) { | ||
46 | _log_count.error++; | ||
47 | $('#debug').append( '<div class="log-error">'+this.join(arguments)+'</div>' ); | ||
48 | this.counter(); | ||
49 | } | ||
50 | }, | ||
51 | }; |
ViewVC Help | |
Powered by ViewVC 1.1.26 |