log4javascript-rails 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +25 -0
- data/lib/log4javascript-rails.rb +8 -0
- data/lib/log4javascript-rails/version.rb +5 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6.tar.gz +0 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/changelog.txt +379 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/console.html +263 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/console_uncompressed.html +2279 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/demos/basic.html +159 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/demos/blank.html +4 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/demos/index.html +49 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/demos/inpage.html +174 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/demos/lite.html +148 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/backwardsincompatibilities.html +90 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/distribution.html +87 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/index.html +190 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/lite.html +182 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/manual.html +3198 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/manual_lite.html +383 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/quickstart.html +230 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/docs/whatsnew.html +86 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/examples/demo.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/examples/example_manual.html +31 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/examples/example_quickstart_1.html +36 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/examples/myloggingservlet.do +0 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/console.html +263 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/console_uncompressed.html +2279 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/liteconsole.html +41 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/liteconsole_uncompressed.html +194 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/log4javascript.js +274 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/log4javascript_lite.js +55 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/log4javascript_lite_uncompressed.js +620 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/log4javascript_production.js +188 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/log4javascript_production_uncompressed.js +2290 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/log4javascript_uncompressed.js +5879 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/stubs/log4javascript.js +23 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/stubs/log4javascript_lite.js +21 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/stubs/log4javascript_lite_uncompressed.js +102 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/stubs/log4javascript_production.js +22 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/stubs/log4javascript_production_uncompressed.js +253 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/stubs/log4javascript_uncompressed.js +341 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/tests/log4javascript.js +32 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/tests/log4javascript_lite.js +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/tests/log4javascript_lite_uncompressed.js +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/tests/log4javascript_production.js +28 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/tests/log4javascript_production_uncompressed.js +728 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/js/tests/log4javascript_uncompressed.js +862 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/license.txt +201 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/log4javascript.js +274 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/log4javascript_uncompressed.js +5879 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/main.css +300 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/index.html +15 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/log4javascript.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/log4javascript_lite.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/log4javascript_lite_uncompressed.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/log4javascript_production.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/log4javascript_production_uncompressed.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/log4javascript_uncompressed.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/main.html +16 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/tests.css +88 -0
- data/vendor/assets/javascripts/log4javascript-1.4.6/test/xntest.js +739 -0
- data/vendor/assets/javascripts/log4javascript.js +1 -0
- data/vendor/assets/stylesheets/angular-ng-grid-rails.css +439 -0
- metadata +107 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 iniciontingookou
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Log4javascript-rails
|
2
|
+
|
3
|
+
Log4javascript-rails wraps the [Log4javascript](http://log4javascript.org/) component for use in Rails 3.1 and above. Assets will minify automatically during production.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add the following to your gemfile:
|
8
|
+
|
9
|
+
gem 'log4javascript-rails'
|
10
|
+
|
11
|
+
Add the following directive to your Javascript manifest file (application.js):
|
12
|
+
|
13
|
+
//= require log4javascript-rails
|
14
|
+
|
15
|
+
## Version
|
16
|
+
|
17
|
+
The gem version will try match the original log4javascript release version.
|
18
|
+
|
19
|
+
# License
|
20
|
+
|
21
|
+
MIT
|
22
|
+
|
23
|
+
# Thanks
|
24
|
+
|
25
|
+
Gem based on Angularjs-rails(http://log4javascript.org/) by Tim Down. tim@log4javascript.org
|
Binary file
|
@@ -0,0 +1,379 @@
|
|
1
|
+
log4javascript change log
|
2
|
+
-------------------------
|
3
|
+
|
4
|
+
1.4.6 (19/3/2013)
|
5
|
+
- Added fix to handle 1223 status code from XMLHttpRequest in IE
|
6
|
+
|
7
|
+
1.4.5 (20/2/2013)
|
8
|
+
- Changed AjaxAppender to send raw data rather than URL-encoded form data when
|
9
|
+
content-type is not "application/x-www-form-urlencoded"
|
10
|
+
|
11
|
+
- Exposed sendAllRemaining() method of AjaxAppender
|
12
|
+
|
13
|
+
1.4.4 (8/2/2013)
|
14
|
+
- Fixed issue with repeated Content-Type headers in AjaxAppender
|
15
|
+
|
16
|
+
- Improved uniqueness of PopUpAppender window name
|
17
|
+
|
18
|
+
1.4.3 (18/9/2012)
|
19
|
+
- Added addHeader() and getHeaders() methods to AjaxAppender
|
20
|
+
|
21
|
+
- Modified sendAllOnUnload feature of AjaxAppender. It now works in WebKit but
|
22
|
+
at the expense of popping up a confirm dialog. That being the case, it is now
|
23
|
+
disabled by default.
|
24
|
+
|
25
|
+
- Removed leaked global variable "initialized"
|
26
|
+
|
27
|
+
- Fixed bugs #3528265, #3560924, #3560922, #2805479, #3510639 on Sourceforge
|
28
|
+
Tracker
|
29
|
+
|
30
|
+
|
31
|
+
1.4.2 (13/10/2011)
|
32
|
+
- Fixed JsonLayout trailing comma issue. See
|
33
|
+
http://stackoverflow.com/questions/7735382/asmx-weirdness-deserializing-json-
|
34
|
+
blob-from-log4javascript-logging
|
35
|
+
|
36
|
+
- Fixed bugs #3401332, #3185753, #2884623, #2817213 on Sourceforge Tracker
|
37
|
+
|
38
|
+
|
39
|
+
1.4.1 (23/3/2009)
|
40
|
+
- Fixed document.domain/query string bug (#2519903 on Sourceforge Tracker)
|
41
|
+
|
42
|
+
- Added isVisible() method to PopUpAppender
|
43
|
+
|
44
|
+
- Added check for whether the console has been closed in isVisible() method of
|
45
|
+
InPageAppender
|
46
|
+
|
47
|
+
- Included unit tests in the distribution
|
48
|
+
|
49
|
+
|
50
|
+
1.4 (30/10/2008)
|
51
|
+
|
52
|
+
- Added time() and timeEnd() methods to Logger
|
53
|
+
|
54
|
+
- Added group() and groupEnd() methods to Logger and support for displaying
|
55
|
+
expandable groups to InPageAppender and PopUpAppender
|
56
|
+
|
57
|
+
- Added facility to layout custom fields. A custom field value may now
|
58
|
+
optionally be a function which is passed a reference to the layout and a
|
59
|
+
logging event and run at the time the layout's format method is called
|
60
|
+
|
61
|
+
- Added option to XmlLayout and JsonLayout to allow multiple messages to be
|
62
|
+
formatted either as one combined message or multiple messages
|
63
|
+
|
64
|
+
- Added code to set log4javascript as a property of the window object. This
|
65
|
+
ensures that if log4javascript is loaded via eval() (e.g. Dojo's module
|
66
|
+
loading system), the log4javascript object is guaranteed to be available even
|
67
|
+
though IE does not evaluate the script in the global scope
|
68
|
+
|
69
|
+
- Added useDocumentWrite parameter to constructors and isUseDocumentWrite()
|
70
|
+
and setUseDocumentWrite() methods for InPageAppender and PopUpAppender and
|
71
|
+
added console.html to the build so that the appender may use either the
|
72
|
+
existing document.write method or the external HTML file to build the console.
|
73
|
+
This is to allow support for setting document.domain in the main document,
|
74
|
+
which is impossible with the document.write method
|
75
|
+
|
76
|
+
- Added milliseconds property to logging events and changed JsonLayout,
|
77
|
+
XmlLayout and HttpPostDataLayout to include milliseconds by default
|
78
|
+
|
79
|
+
- Added layout parameter to AjaxAppender and a toString() method on each layout
|
80
|
+
|
81
|
+
- Setting configuration properties in appenders via constructor paramaters has
|
82
|
+
been phased out.
|
83
|
+
|
84
|
+
- Added window.unload handler for AjaxAppender to send outstanding messages.
|
85
|
+
Doesn't work in Opera
|
86
|
+
|
87
|
+
- Implemented log4j-style hierarchical loggers with additive appenders. For
|
88
|
+
example, a logger called "app.stuff" has as its parent the logger called
|
89
|
+
"app", all of whose appenders it inherits
|
90
|
+
|
91
|
+
- Changed XmlLayout and JsonLayout to send data as a key/value pair
|
92
|
+
|
93
|
+
- Bugfix for inaccessible error details
|
94
|
+
|
95
|
+
- An appender can no longer be added more than once to the same logger
|
96
|
+
|
97
|
+
- Multiple messages may now be specified in logger methods
|
98
|
+
|
99
|
+
- New conversion character 'a' added to PatternLayout. This is the same as 'm'
|
100
|
+
except that if the first message specified is an array then it treats each
|
101
|
+
element of the array as though it had been passed in as a message parameter
|
102
|
+
|
103
|
+
- Command line added to console windows with configurable object expansion
|
104
|
+
depth. Command line presence and object expansion depth are configurable in
|
105
|
+
the appender via setShowCommandLine() and setCommandLineObjectExpansionDepth()
|
106
|
+
methods respectively
|
107
|
+
|
108
|
+
- Command line history, navigated by cursor keys and stored in a session cookie
|
109
|
+
|
110
|
+
- Firebug-inspired command line functions added: $, dir, dirxml, cd, clear,
|
111
|
+
keys, values, expansionDepth
|
112
|
+
|
113
|
+
- Fixes for several bugs in object expansion
|
114
|
+
|
115
|
+
- Fix for bug in initialization of InPageAppender in IE 5
|
116
|
+
|
117
|
+
- Fix to allow searchable HTML in log entries
|
118
|
+
|
119
|
+
- Fix for bug which automatically displayed search next/previous buttons when
|
120
|
+
the search box is clicked regardless of whether there were any matches
|
121
|
+
|
122
|
+
- Searches in PopUpAppender and InPageAppender now preserve formatting
|
123
|
+
|
124
|
+
- More fixes to interaction of search and severity filters in console window
|
125
|
+
used by PopUpAppender and InPageAppender
|
126
|
+
|
127
|
+
- Added SwitchableConsoleAppender that allows flipping from an in-page console
|
128
|
+
to a pop-up console window and back again while retaining state
|
129
|
+
|
130
|
+
- Custom events added that are raised when PopUpAppender and InPageAppender
|
131
|
+
windows load and unload, and on the main log4javascript object when the main
|
132
|
+
page loads, when the main page is resized and when log4javascript errors occur
|
133
|
+
|
134
|
+
- InPageAppender may now be initialized before the page loads by providing an
|
135
|
+
element id for its container, or omitting the container altogether (in which
|
136
|
+
case the appender is added as a fixed div at the bottom of the page)
|
137
|
+
|
138
|
+
- Tweaked PopUpAppender and InPageAppender so that the formatted log message is
|
139
|
+
produced when append() is called rather than when the message is actually sent
|
140
|
+
to the console window, thus allowing reliable temporary switching of layouts
|
141
|
+
|
142
|
+
- Much improved scrolling to current search match: scrolls only if part of the
|
143
|
+
search match is not visible and centres around it rather than putting flush to
|
144
|
+
the top left
|
145
|
+
|
146
|
+
- Removed setReadable() method from JsonLayout - now specified only in the
|
147
|
+
constructor
|
148
|
+
|
149
|
+
- Fixed problem in IE where copying selections of log entries would produce two
|
150
|
+
copies of each log entry
|
151
|
+
|
152
|
+
|
153
|
+
1.3.1 (20/11/2006)
|
154
|
+
|
155
|
+
- Fix to interaction of search and severity filters in console window used by
|
156
|
+
PopUpAppender and InPageAppender
|
157
|
+
|
158
|
+
|
159
|
+
1.3 (19/10/2006)
|
160
|
+
|
161
|
+
- Fully tested and supported in IE 7 Beta 3
|
162
|
+
|
163
|
+
- Added support for FireBug logging levels in BrowserConsoleAppender
|
164
|
+
|
165
|
+
- Added optional limit to the number of log messages stored by PopUpAppender and
|
166
|
+
InPageAppender. When this limit is reached, each new message causes the oldest
|
167
|
+
message to be discarded.
|
168
|
+
|
169
|
+
- Exceptions passed into logging methods are now displayed in logging output.
|
170
|
+
|
171
|
+
- Added facility to pass objects as well as strings to logging methods.
|
172
|
+
Enhanced conversion character 'm' to PatternLayout to expand object properties
|
173
|
+
in the formatted output
|
174
|
+
|
175
|
+
- Added stack trace to error reports (alerts and log entries) in Firefox. This
|
176
|
+
is turned off by default but can be switched on via the new
|
177
|
+
log4javascript.setShowStackTraces function
|
178
|
+
|
179
|
+
- Added log4javascript_stub.js to distribution - this has stub versions of all
|
180
|
+
objects and methods in log4javascript.js and can be used as a lightweight
|
181
|
+
replacement for log4javascript.js in production systems
|
182
|
+
|
183
|
+
- Added log4javascript_compressed.js to distribution - comments and whitespace
|
184
|
+
are removed, resulting in a 30% smaller file
|
185
|
+
|
186
|
+
- Added custom fields to layouts
|
187
|
+
|
188
|
+
- Added setReopenWhenClosed and isReopenWhenClosed methods to PopUpAppender to
|
189
|
+
allow log4javascript to open a new pop-up console window automatically at the
|
190
|
+
time of the next log entry after the original window was closed
|
191
|
+
|
192
|
+
- Layout.ignoresThrowable implemented to allow Layout/Appender combinations to
|
193
|
+
decide whether to display exceptions
|
194
|
+
|
195
|
+
- Added NullLayout that performs no formatting on the logging event
|
196
|
+
|
197
|
+
- Lowered BrowserConsoleAppender's default threshold to DEBUG and set its
|
198
|
+
default layout to NullLayout so that unformatted objects can be passed into
|
199
|
+
FireBug
|
200
|
+
|
201
|
+
- Renamed InlineAppender to InPageAppender (though InlineAppender still works
|
202
|
+
for the sake of backwards compatibility)
|
203
|
+
|
204
|
+
- Cosmetic changes to InPageAppender and PopUpAppender
|
205
|
+
|
206
|
+
- Added equals() method to Level
|
207
|
+
|
208
|
+
- Added removeAppender() and removeAllAppenders() methods to Logger
|
209
|
+
|
210
|
+
- Added extensive test script
|
211
|
+
|
212
|
+
- Fixed bug where Appender.setLayout and Appender.setThreshold threw an
|
213
|
+
unhandled error if not supplied with a genuine Layout or Level respectively
|
214
|
+
|
215
|
+
- Fixed bug where InlinePopUpAppender and PopUpAppender continue to poll their
|
216
|
+
console windows indefinitely (thus generating warnings) if the console window
|
217
|
+
is closed before it has fully loaded
|
218
|
+
|
219
|
+
- Fixed bug in w and W symbols in SimpleDateFormat
|
220
|
+
|
221
|
+
- Fixed bug with quotes inside messages in JsonLayout
|
222
|
+
|
223
|
+
- Fixed bugs in PatternLayout with built-in DATE format and truncation modifiers
|
224
|
+
|
225
|
+
- Changed execution order of callbacks in AjaxAppender so that
|
226
|
+
requestSuccessCallback is guaranteed to be called before the next request is
|
227
|
+
sent
|
228
|
+
|
229
|
+
- Changed AjaxAppender so that log messages are formatted immediately before
|
230
|
+
a request is sent rather than when append() is called, thus guaranteeing that
|
231
|
+
changes to the layout take effect immediately
|
232
|
+
|
233
|
+
- PopUpAppender windows now have unique names per hostname to prevent clashes
|
234
|
+
from multiple instances of log4javascript running on different servers
|
235
|
+
|
236
|
+
- Fixed error in XmlLayout's format method when passed an object
|
237
|
+
|
238
|
+
- Fixed errors in JsonLayout's handling of strings containing line breaks and/or
|
239
|
+
double quotes
|
240
|
+
|
241
|
+
|
242
|
+
1.2 (21/6/2006)
|
243
|
+
|
244
|
+
- Tested in and added workaround for a bug in Opera 9 Beta 2 and Opera 9.0
|
245
|
+
|
246
|
+
- Tested in Konqueror 3.4 and 3.5 and added workarounds and fixes for browser
|
247
|
+
bugs
|
248
|
+
|
249
|
+
- Added addErrorListener and removeErrorListener methods to log4javascript
|
250
|
+
object to allow custom error handling
|
251
|
+
|
252
|
+
- Added close() method to PopUpAppender and InlineAppender
|
253
|
+
|
254
|
+
- Added test directory with an HTML page containing automated tests
|
255
|
+
|
256
|
+
- Added enable/disable logging checkbox to InlinePopUpAppender and PopUpAppender
|
257
|
+
so that unnecessary messages (for instance, from a timer) can be ignored
|
258
|
+
|
259
|
+
- An invalid value supplied to a configuration option setter now leaves config
|
260
|
+
property unchanged rather than reverting to the default
|
261
|
+
|
262
|
+
- Fixed bug in PopUpAppender in IE on Windows XP Service Pack 2 when accessed
|
263
|
+
via the file system. The browser by default disables JavaScript in the pop-up
|
264
|
+
window until the user opts to enable it, at which point they would previously
|
265
|
+
see an uncaught error in log4javascript. Now, a proper error message is
|
266
|
+
displayed and the appender is disabled.
|
267
|
+
|
268
|
+
- Slight alterations to toolbar in InlineAppender and PopUpAppender - text
|
269
|
+
capitalization and title attributes added to inputs
|
270
|
+
|
271
|
+
- toString() method added to all appenders
|
272
|
+
|
273
|
+
- Correction to errors in XmlLayout's output
|
274
|
+
|
275
|
+
- Documentation corrections and additions
|
276
|
+
|
277
|
+
|
278
|
+
1.1.1 (17/5/2006)
|
279
|
+
|
280
|
+
- Fixed a minor bug with scrolling to the latest message and added "scroll to
|
281
|
+
latest" checkbox to console window in InlineAppender and PopUpAppender
|
282
|
+
|
283
|
+
|
284
|
+
1.1 (16/5/2006)
|
285
|
+
|
286
|
+
- Added configuration option setters on Appenders and refactored to prevent
|
287
|
+
config properties being altered directly. Several configuration options
|
288
|
+
may not be altered after the appender has been initialized
|
289
|
+
|
290
|
+
- Added scrollToLatestMessage constructor parameter, isScrollToLatestMessage
|
291
|
+
and setScrollToLatestMessage methods to InlineAppender and PopUpAppender
|
292
|
+
|
293
|
+
- Added isVisible method to InlineAppender
|
294
|
+
|
295
|
+
- Changed setShowOneError to setAlertAllErrors in logLog, with obvious change
|
296
|
+
in logic
|
297
|
+
|
298
|
+
- Added layout property key configuration options to layout constructors for
|
299
|
+
JsonLayout and HttpPostDataLayout
|
300
|
+
|
301
|
+
- Changed the default timestamp property name to "timestamp" instead of
|
302
|
+
"timeStamp" in JsonLayout and HttpPostDataLayout
|
303
|
+
|
304
|
+
- Expanded documentation to include a section in the manual about configuring
|
305
|
+
appenders
|
306
|
+
|
307
|
+
- Removed browser sniffing code
|
308
|
+
|
309
|
+
|
310
|
+
1.0.1 (30/4/2006)
|
311
|
+
|
312
|
+
- Option to have new log messages appear at the top added to InlineAppender and
|
313
|
+
PopUpAppender. This option can be specified in the constructor and can also
|
314
|
+
be toggled via a checkbox in the console window
|
315
|
+
|
316
|
+
- PopUpAppender changed to not focus the pop-up console window by default, and
|
317
|
+
the demo page altered to create its own logger with focussing turned on,
|
318
|
+
meaning the behaviour in the demo is essentially unchanged
|
319
|
+
|
320
|
+
|
321
|
+
1.0 (26/4/2006)
|
322
|
+
|
323
|
+
- Tweaks to default values in PopUpAppender and InlineAppender
|
324
|
+
|
325
|
+
- Bugfixes and stylistic tweaks resulting from running JSLint on
|
326
|
+
log4javascript.js
|
327
|
+
|
328
|
+
|
329
|
+
1.0 beta 2
|
330
|
+
|
331
|
+
- Show/hide button removed from InlineAppender, replaced by show() and hide()
|
332
|
+
methods on the InlineAppender object
|
333
|
+
|
334
|
+
- batchSeparator, batchHeader and batchFooter added to Layout and applied to
|
335
|
+
JsonLayout - a batch of JSON log messages is now created as an array literal
|
336
|
+
|
337
|
+
|
338
|
+
1.0 beta
|
339
|
+
|
340
|
+
- TRACE level added, since this was added to log4j in 1.2.12
|
341
|
+
|
342
|
+
- PopUpAppender default settings bugfix
|
343
|
+
|
344
|
+
- getLevel method added to Logger
|
345
|
+
|
346
|
+
- Tweak to vertical alignment of checkboxes and padding of buttons in
|
347
|
+
InlineAppender and PopUpAppender
|
348
|
+
|
349
|
+
- Fixed getDefaultLogger and getNullLogger to return loggers other than the
|
350
|
+
root logger
|
351
|
+
|
352
|
+
0.96
|
353
|
+
|
354
|
+
- Moved console.html to inline document.writes in log4javascript.js
|
355
|
+
|
356
|
+
- Fixed getDefaultLogger to return the same object on successive calls
|
357
|
+
|
358
|
+
- Fixed scrolling issue in Opera InlineAppender and PopUpAppender
|
359
|
+
|
360
|
+
- Scrollbars are now automatic on InlineAppender and PopUpAppender, i.e. they
|
361
|
+
only appear when required
|
362
|
+
|
363
|
+
- Fixed bug where regex searches were not applied to new log entries in
|
364
|
+
InlineAppender and PopUpAppender
|
365
|
+
|
366
|
+
- Changed Safari font size in InlineAppender and PopUpAppender
|
367
|
+
|
368
|
+
0.95
|
369
|
+
|
370
|
+
- AjaxAppender enhancements:
|
371
|
+
- waitForResponse added
|
372
|
+
- timer added
|
373
|
+
|
374
|
+
- layout parameter added to all appender constructors
|
375
|
+
|
376
|
+
0.94
|
377
|
+
- First publicly available version
|
378
|
+
- IE 5 support added
|
379
|
+
- Full support for wrapping in IE added for InlineAppender and PopUpAppender
|
@@ -0,0 +1,263 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
3
|
+
<head>
|
4
|
+
<title>log4javascript</title>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<!-- Make IE8 behave like IE7, having gone to all the trouble of making IE work -->
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="IE=7" />
|
8
|
+
<script type="text/javascript">var isIe = false, isIePre7 = false;</script>
|
9
|
+
<!--[if IE]><script type="text/javascript">isIe = true</script><![endif]-->
|
10
|
+
<!--[if lt IE 7]><script type="text/javascript">isIePre7 = true</script><![endif]-->
|
11
|
+
<script type="text/javascript">
|
12
|
+
//<![CDATA[
|
13
|
+
var loggingEnabled=true;var logQueuedEventsTimer=null;var logEntries=[];var logEntriesAndSeparators=[];var logItems=[];var renderDelay=100;var unrenderedLogItemsExist=false;var rootGroup,currentGroup=null;var loaded=false;var currentLogItem=null;var logMainContainer;function copyProperties(obj,props){for(var i in props){obj[i]=props[i];}}
|
14
|
+
function LogItem(){}
|
15
|
+
LogItem.prototype={mainContainer:null,wrappedContainer:null,unwrappedContainer:null,group:null,appendToLog:function(){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].appendToLog();}
|
16
|
+
this.group.update();},doRemove:function(doUpdate,removeFromGroup){if(this.rendered){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].remove();}
|
17
|
+
this.unwrappedElementContainer=null;this.wrappedElementContainer=null;this.mainElementContainer=null;}
|
18
|
+
if(this.group&&removeFromGroup){this.group.removeChild(this,doUpdate);}
|
19
|
+
if(this===currentLogItem){currentLogItem=null;}},remove:function(doUpdate,removeFromGroup){this.doRemove(doUpdate,removeFromGroup);},render:function(){},accept:function(visitor){visitor.visit(this);},getUnwrappedDomContainer:function(){return this.group.unwrappedElementContainer.contentDiv;},getWrappedDomContainer:function(){return this.group.wrappedElementContainer.contentDiv;},getMainDomContainer:function(){return this.group.mainElementContainer.contentDiv;}};LogItem.serializedItemKeys={LOG_ENTRY:0,GROUP_START:1,GROUP_END:2};function LogItemContainerElement(){}
|
20
|
+
LogItemContainerElement.prototype={appendToLog:function(){var insertBeforeFirst=(newestAtTop&&this.containerDomNode.hasChildNodes());if(insertBeforeFirst){this.containerDomNode.insertBefore(this.mainDiv,this.containerDomNode.firstChild);}else{this.containerDomNode.appendChild(this.mainDiv);}}};function SeparatorElementContainer(containerDomNode){this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.className="separator";this.mainDiv.innerHTML=" ";}
|
21
|
+
SeparatorElementContainer.prototype=new LogItemContainerElement();SeparatorElementContainer.prototype.remove=function(){this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null;};function Separator(){this.rendered=false;}
|
22
|
+
Separator.prototype=new LogItem();copyProperties(Separator.prototype,{render:function(){var containerDomNode=this.group.contentDiv;if(isIe){this.unwrappedElementContainer=new SeparatorElementContainer(this.getUnwrappedDomContainer());this.wrappedElementContainer=new SeparatorElementContainer(this.getWrappedDomContainer());this.elementContainers=[this.unwrappedElementContainer,this.wrappedElementContainer];}else{this.mainElementContainer=new SeparatorElementContainer(this.getMainDomContainer());this.elementContainers=[this.mainElementContainer];}
|
23
|
+
this.content=this.formattedMessage;this.rendered=true;}});function GroupElementContainer(group,containerDomNode,isRoot,isWrapped){this.group=group;this.containerDomNode=containerDomNode;this.isRoot=isRoot;this.isWrapped=isWrapped;this.expandable=false;if(this.isRoot){if(isIe){this.contentDiv=logMainContainer.appendChild(document.createElement("div"));this.contentDiv.id=this.isWrapped?"log_wrapped":"log_unwrapped";}else{this.contentDiv=logMainContainer;}}else{var groupElementContainer=this;this.mainDiv=document.createElement("div");this.mainDiv.className="group";this.headingDiv=this.mainDiv.appendChild(document.createElement("div"));this.headingDiv.className="groupheading";this.expander=this.headingDiv.appendChild(document.createElement("span"));this.expander.className="expander unselectable greyedout";this.expander.unselectable=true;var expanderText=this.group.expanded?"-":"+";this.expanderTextNode=this.expander.appendChild(document.createTextNode(expanderText));this.headingDiv.appendChild(document.createTextNode(" "+this.group.name));this.contentDiv=this.mainDiv.appendChild(document.createElement("div"));var contentCssClass=this.group.expanded?"expanded":"collapsed";this.contentDiv.className="groupcontent "+contentCssClass;this.expander.onclick=function(){if(groupElementContainer.group.expandable){groupElementContainer.group.toggleExpanded();}};}}
|
24
|
+
GroupElementContainer.prototype=new LogItemContainerElement();copyProperties(GroupElementContainer.prototype,{toggleExpanded:function(){if(!this.isRoot){var oldCssClass,newCssClass,expanderText;if(this.group.expanded){newCssClass="expanded";oldCssClass="collapsed";expanderText="-";}else{newCssClass="collapsed";oldCssClass="expanded";expanderText="+";}
|
25
|
+
replaceClass(this.contentDiv,newCssClass,oldCssClass);this.expanderTextNode.nodeValue=expanderText;}},remove:function(){if(!this.isRoot){this.headingDiv=null;this.expander.onclick=null;this.expander=null;this.expanderTextNode=null;this.contentDiv=null;this.containerDomNode=null;this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null;}},reverseChildren:function(){var node=null;var childDomNodes=[];while((node=this.contentDiv.firstChild)){this.contentDiv.removeChild(node);childDomNodes.push(node);}
|
26
|
+
while((node=childDomNodes.pop())){this.contentDiv.appendChild(node);}},update:function(){if(!this.isRoot){if(this.group.expandable){removeClass(this.expander,"greyedout");}else{addClass(this.expander,"greyedout");}}},clear:function(){if(this.isRoot){this.contentDiv.innerHTML="";}}});function Group(name,isRoot,initiallyExpanded){this.name=name;this.group=null;this.isRoot=isRoot;this.initiallyExpanded=initiallyExpanded;this.elementContainers=[];this.children=[];this.expanded=initiallyExpanded;this.rendered=false;this.expandable=false;}
|
27
|
+
Group.prototype=new LogItem();copyProperties(Group.prototype,{addChild:function(logItem){this.children.push(logItem);logItem.group=this;},render:function(){if(isIe){var unwrappedDomContainer,wrappedDomContainer;if(this.isRoot){unwrappedDomContainer=logMainContainer;wrappedDomContainer=logMainContainer;}else{unwrappedDomContainer=this.getUnwrappedDomContainer();wrappedDomContainer=this.getWrappedDomContainer();}
|
28
|
+
this.unwrappedElementContainer=new GroupElementContainer(this,unwrappedDomContainer,this.isRoot,false);this.wrappedElementContainer=new GroupElementContainer(this,wrappedDomContainer,this.isRoot,true);this.elementContainers=[this.unwrappedElementContainer,this.wrappedElementContainer];}else{var mainDomContainer=this.isRoot?logMainContainer:this.getMainDomContainer();this.mainElementContainer=new GroupElementContainer(this,mainDomContainer,this.isRoot,false);this.elementContainers=[this.mainElementContainer];}
|
29
|
+
this.rendered=true;},toggleExpanded:function(){this.expanded=!this.expanded;for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].toggleExpanded();}},expand:function(){if(!this.expanded){this.toggleExpanded();}},accept:function(visitor){visitor.visitGroup(this);},reverseChildren:function(){if(this.rendered){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].reverseChildren();}}},update:function(){var previouslyExpandable=this.expandable;this.expandable=(this.children.length!==0);if(this.expandable!==previouslyExpandable){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].update();}}},flatten:function(){var visitor=new GroupFlattener();this.accept(visitor);return visitor.logEntriesAndSeparators;},removeChild:function(child,doUpdate){array_remove(this.children,child);child.group=null;if(doUpdate){this.update();}},remove:function(doUpdate,removeFromGroup){for(var i=0,len=this.children.length;i<len;i++){this.children[i].remove(false,false);}
|
30
|
+
this.children=[];this.update();if(this===currentGroup){currentGroup=this.group;}
|
31
|
+
this.doRemove(doUpdate,removeFromGroup);},serialize:function(items){items.push([LogItem.serializedItemKeys.GROUP_START,this.name]);for(var i=0,len=this.children.length;i<len;i++){this.children[i].serialize(items);}
|
32
|
+
if(this!==currentGroup){items.push([LogItem.serializedItemKeys.GROUP_END]);}},clear:function(){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].clear();}}});function LogEntryElementContainer(){}
|
33
|
+
LogEntryElementContainer.prototype=new LogItemContainerElement();copyProperties(LogEntryElementContainer.prototype,{remove:function(){this.doRemove();},doRemove:function(){this.mainDiv.parentNode.removeChild(this.mainDiv);this.mainDiv=null;this.contentElement=null;this.containerDomNode=null;},setContent:function(content,wrappedContent){if(content===this.formattedMessage){this.contentElement.innerHTML="";this.contentElement.appendChild(document.createTextNode(this.formattedMessage));}else{this.contentElement.innerHTML=content;}},setSearchMatch:function(isMatch){var oldCssClass=isMatch?"searchnonmatch":"searchmatch";var newCssClass=isMatch?"searchmatch":"searchnonmatch";replaceClass(this.mainDiv,newCssClass,oldCssClass);},clearSearch:function(){removeClass(this.mainDiv,"searchmatch");removeClass(this.mainDiv,"searchnonmatch");}});function LogEntryWrappedElementContainer(logEntry,containerDomNode){this.logEntry=logEntry;this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.appendChild(document.createTextNode(this.logEntry.formattedMessage));this.mainDiv.className="logentry wrapped "+this.logEntry.level;this.contentElement=this.mainDiv;}
|
34
|
+
LogEntryWrappedElementContainer.prototype=new LogEntryElementContainer();LogEntryWrappedElementContainer.prototype.setContent=function(content,wrappedContent){if(content===this.formattedMessage){this.contentElement.innerHTML="";this.contentElement.appendChild(document.createTextNode(this.formattedMessage));}else{this.contentElement.innerHTML=wrappedContent;}};function LogEntryUnwrappedElementContainer(logEntry,containerDomNode){this.logEntry=logEntry;this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.className="logentry unwrapped "+this.logEntry.level;this.pre=this.mainDiv.appendChild(document.createElement("pre"));this.pre.appendChild(document.createTextNode(this.logEntry.formattedMessage));this.pre.className="unwrapped";this.contentElement=this.pre;}
|
35
|
+
LogEntryUnwrappedElementContainer.prototype=new LogEntryElementContainer();LogEntryUnwrappedElementContainer.prototype.remove=function(){this.doRemove();this.pre=null;};function LogEntryMainElementContainer(logEntry,containerDomNode){this.logEntry=logEntry;this.containerDomNode=containerDomNode;this.mainDiv=document.createElement("div");this.mainDiv.className="logentry nonielogentry "+this.logEntry.level;this.contentElement=this.mainDiv.appendChild(document.createElement("span"));this.contentElement.appendChild(document.createTextNode(this.logEntry.formattedMessage));}
|
36
|
+
LogEntryMainElementContainer.prototype=new LogEntryElementContainer();function LogEntry(level,formattedMessage){this.level=level;this.formattedMessage=formattedMessage;this.rendered=false;}
|
37
|
+
LogEntry.prototype=new LogItem();copyProperties(LogEntry.prototype,{render:function(){var logEntry=this;var containerDomNode=this.group.contentDiv;if(isIe){this.formattedMessage=this.formattedMessage.replace(/\r\n/g,"\r");this.unwrappedElementContainer=new LogEntryUnwrappedElementContainer(this,this.getUnwrappedDomContainer());this.wrappedElementContainer=new LogEntryWrappedElementContainer(this,this.getWrappedDomContainer());this.elementContainers=[this.unwrappedElementContainer,this.wrappedElementContainer];}else{this.mainElementContainer=new LogEntryMainElementContainer(this,this.getMainDomContainer());this.elementContainers=[this.mainElementContainer];}
|
38
|
+
this.content=this.formattedMessage;this.rendered=true;},setContent:function(content,wrappedContent){if(content!=this.content){if(isIe&&(content!==this.formattedMessage)){content=content.replace(/\r\n/g,"\r");}
|
39
|
+
for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].setContent(content,wrappedContent);}
|
40
|
+
this.content=content;}},getSearchMatches:function(){var matches=[];var i,len;if(isIe){var unwrappedEls=getElementsByClass(this.unwrappedElementContainer.mainDiv,"searchterm","span");var wrappedEls=getElementsByClass(this.wrappedElementContainer.mainDiv,"searchterm","span");for(i=0,len=unwrappedEls.length;i<len;i++){matches[i]=new Match(this.level,null,unwrappedEls[i],wrappedEls[i]);}}else{var els=getElementsByClass(this.mainElementContainer.mainDiv,"searchterm","span");for(i=0,len=els.length;i<len;i++){matches[i]=new Match(this.level,els[i]);}}
|
41
|
+
return matches;},setSearchMatch:function(isMatch){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].setSearchMatch(isMatch);}},clearSearch:function(){for(var i=0,len=this.elementContainers.length;i<len;i++){this.elementContainers[i].clearSearch();}},accept:function(visitor){visitor.visitLogEntry(this);},serialize:function(items){items.push([LogItem.serializedItemKeys.LOG_ENTRY,this.level,this.formattedMessage]);}});function LogItemVisitor(){}
|
42
|
+
LogItemVisitor.prototype={visit:function(logItem){},visitParent:function(logItem){if(logItem.group){logItem.group.accept(this);}},visitChildren:function(logItem){for(var i=0,len=logItem.children.length;i<len;i++){logItem.children[i].accept(this);}},visitLogEntry:function(logEntry){this.visit(logEntry);},visitSeparator:function(separator){this.visit(separator);},visitGroup:function(group){this.visit(group);}};function GroupFlattener(){this.logEntriesAndSeparators=[];}
|
43
|
+
GroupFlattener.prototype=new LogItemVisitor();GroupFlattener.prototype.visitGroup=function(group){this.visitChildren(group);};GroupFlattener.prototype.visitLogEntry=function(logEntry){this.logEntriesAndSeparators.push(logEntry);};GroupFlattener.prototype.visitSeparator=function(separator){this.logEntriesAndSeparators.push(separator);};window.onload=function(){if(location.search){var queryBits=unescape(location.search).substr(1).split("&"),nameValueBits;for(var i=0,len=queryBits.length;i<len;i++){nameValueBits=queryBits[i].split("=");if(nameValueBits[0]=="log4javascript_domain"){document.domain=nameValueBits[1];break;}}}
|
44
|
+
logMainContainer=$("log");if(isIePre7){addClass(logMainContainer,"oldIe");}
|
45
|
+
rootGroup=new Group("root",true);rootGroup.render();currentGroup=rootGroup;setCommandInputWidth();setLogContainerHeight();toggleLoggingEnabled();toggleSearchEnabled();toggleSearchFilter();toggleSearchHighlight();applyFilters();checkAllLevels();toggleWrap();toggleNewestAtTop();toggleScrollToLatest();renderQueuedLogItems();loaded=true;$("command").value="";$("command").autocomplete="off";$("command").onkeydown=function(evt){evt=getEvent(evt);if(evt.keyCode==10||evt.keyCode==13){evalCommandLine();stopPropagation(evt);}else if(evt.keyCode==27){this.value="";this.focus();}else if(evt.keyCode==38&&commandHistory.length>0){currentCommandIndex=Math.max(0,currentCommandIndex-1);this.value=commandHistory[currentCommandIndex];moveCaretToEnd(this);}else if(evt.keyCode==40&&commandHistory.length>0){currentCommandIndex=Math.min(commandHistory.length-1,currentCommandIndex+1);this.value=commandHistory[currentCommandIndex];moveCaretToEnd(this);}};$("command").onkeypress=function(evt){evt=getEvent(evt);if(evt.keyCode==38&&commandHistory.length>0&&evt.preventDefault){evt.preventDefault();}};$("command").onkeyup=function(evt){evt=getEvent(evt);if(evt.keyCode==27&&evt.preventDefault){evt.preventDefault();this.focus();}};document.onkeydown=function keyEventHandler(evt){evt=getEvent(evt);switch(evt.keyCode){case 69:if(evt.shiftKey&&(evt.ctrlKey||evt.metaKey)){evalLastCommand();cancelKeyEvent(evt);return false;}
|
46
|
+
break;case 75:if(evt.shiftKey&&(evt.ctrlKey||evt.metaKey)){focusSearch();cancelKeyEvent(evt);return false;}
|
47
|
+
break;case 40:case 76:if(evt.shiftKey&&(evt.ctrlKey||evt.metaKey)){focusCommandLine();cancelKeyEvent(evt);return false;}
|
48
|
+
break;}};setTimeout(setLogContainerHeight,20);setShowCommandLine(showCommandLine);doSearch();};window.onunload=function(){if(mainWindowExists()){appender.unload();}
|
49
|
+
appender=null;};function toggleLoggingEnabled(){setLoggingEnabled($("enableLogging").checked);}
|
50
|
+
function setLoggingEnabled(enable){loggingEnabled=enable;}
|
51
|
+
var appender=null;function setAppender(appenderParam){appender=appenderParam;}
|
52
|
+
function setShowCloseButton(showCloseButton){$("closeButton").style.display=showCloseButton?"inline":"none";}
|
53
|
+
function setShowHideButton(showHideButton){$("hideButton").style.display=showHideButton?"inline":"none";}
|
54
|
+
var newestAtTop=false;function LogItemContentReverser(){}
|
55
|
+
LogItemContentReverser.prototype=new LogItemVisitor();LogItemContentReverser.prototype.visitGroup=function(group){group.reverseChildren();this.visitChildren(group);};function setNewestAtTop(isNewestAtTop){var oldNewestAtTop=newestAtTop;var i,iLen,j,jLen;newestAtTop=Boolean(isNewestAtTop);if(oldNewestAtTop!=newestAtTop){var visitor=new LogItemContentReverser();rootGroup.accept(visitor);if(currentSearch){var currentMatch=currentSearch.matches[currentMatchIndex];var matchIndex=0;var matches=[];var actOnLogEntry=function(logEntry){var logEntryMatches=logEntry.getSearchMatches();for(j=0,jLen=logEntryMatches.length;j<jLen;j++){matches[matchIndex]=logEntryMatches[j];if(currentMatch&&logEntryMatches[j].equals(currentMatch)){currentMatchIndex=matchIndex;}
|
56
|
+
matchIndex++;}};if(newestAtTop){for(i=logEntries.length-1;i>=0;i--){actOnLogEntry(logEntries[i]);}}else{for(i=0,iLen=logEntries.length;i<iLen;i++){actOnLogEntry(logEntries[i]);}}
|
57
|
+
currentSearch.matches=matches;if(currentMatch){currentMatch.setCurrent();}}else if(scrollToLatest){doScrollToLatest();}}
|
58
|
+
$("newestAtTop").checked=isNewestAtTop;}
|
59
|
+
function toggleNewestAtTop(){var isNewestAtTop=$("newestAtTop").checked;setNewestAtTop(isNewestAtTop);}
|
60
|
+
var scrollToLatest=true;function setScrollToLatest(isScrollToLatest){scrollToLatest=isScrollToLatest;if(scrollToLatest){doScrollToLatest();}
|
61
|
+
$("scrollToLatest").checked=isScrollToLatest;}
|
62
|
+
function toggleScrollToLatest(){var isScrollToLatest=$("scrollToLatest").checked;setScrollToLatest(isScrollToLatest);}
|
63
|
+
function doScrollToLatest(){var l=logMainContainer;if(typeof l.scrollTop!="undefined"){if(newestAtTop){l.scrollTop=0;}else{var latestLogEntry=l.lastChild;if(latestLogEntry){l.scrollTop=l.scrollHeight;}}}}
|
64
|
+
var closeIfOpenerCloses=true;function setCloseIfOpenerCloses(isCloseIfOpenerCloses){closeIfOpenerCloses=isCloseIfOpenerCloses;}
|
65
|
+
var maxMessages=null;function setMaxMessages(max){maxMessages=max;pruneLogEntries();}
|
66
|
+
var showCommandLine=false;function setShowCommandLine(isShowCommandLine){showCommandLine=isShowCommandLine;if(loaded){$("commandLine").style.display=showCommandLine?"block":"none";setCommandInputWidth();setLogContainerHeight();}}
|
67
|
+
function focusCommandLine(){if(loaded){$("command").focus();}}
|
68
|
+
function focusSearch(){if(loaded){$("searchBox").focus();}}
|
69
|
+
function getLogItems(){var items=[];for(var i=0,len=logItems.length;i<len;i++){logItems[i].serialize(items);}
|
70
|
+
return items;}
|
71
|
+
function setLogItems(items){var loggingReallyEnabled=loggingEnabled;loggingEnabled=true;for(var i=0,len=items.length;i<len;i++){switch(items[i][0]){case LogItem.serializedItemKeys.LOG_ENTRY:log(items[i][1],items[i][2]);break;case LogItem.serializedItemKeys.GROUP_START:group(items[i][1]);break;case LogItem.serializedItemKeys.GROUP_END:groupEnd();break;}}
|
72
|
+
loggingEnabled=loggingReallyEnabled;}
|
73
|
+
function log(logLevel,formattedMessage){if(loggingEnabled){var logEntry=new LogEntry(logLevel,formattedMessage);logEntries.push(logEntry);logEntriesAndSeparators.push(logEntry);logItems.push(logEntry);currentGroup.addChild(logEntry);if(loaded){if(logQueuedEventsTimer!==null){clearTimeout(logQueuedEventsTimer);}
|
74
|
+
logQueuedEventsTimer=setTimeout(renderQueuedLogItems,renderDelay);unrenderedLogItemsExist=true;}}}
|
75
|
+
function renderQueuedLogItems(){logQueuedEventsTimer=null;var pruned=pruneLogEntries();var initiallyHasMatches=currentSearch?currentSearch.hasMatches():false;for(var i=0,len=logItems.length;i<len;i++){if(!logItems[i].rendered){logItems[i].render();logItems[i].appendToLog();if(currentSearch&&(logItems[i]instanceof LogEntry)){currentSearch.applyTo(logItems[i]);}}}
|
76
|
+
if(currentSearch){if(pruned){if(currentSearch.hasVisibleMatches()){if(currentMatchIndex===null){setCurrentMatchIndex(0);}
|
77
|
+
displayMatches();}else{displayNoMatches();}}else if(!initiallyHasMatches&¤tSearch.hasVisibleMatches()){setCurrentMatchIndex(0);displayMatches();}}
|
78
|
+
if(scrollToLatest){doScrollToLatest();}
|
79
|
+
unrenderedLogItemsExist=false;}
|
80
|
+
function pruneLogEntries(){if((maxMessages!==null)&&(logEntriesAndSeparators.length>maxMessages)){var numberToDelete=logEntriesAndSeparators.length-maxMessages;var prunedLogEntries=logEntriesAndSeparators.slice(0,numberToDelete);if(currentSearch){currentSearch.removeMatches(prunedLogEntries);}
|
81
|
+
var group;for(var i=0;i<numberToDelete;i++){group=logEntriesAndSeparators[i].group;array_remove(logItems,logEntriesAndSeparators[i]);array_remove(logEntries,logEntriesAndSeparators[i]);logEntriesAndSeparators[i].remove(true,true);if(group.children.length===0&&group!==currentGroup&&group!==rootGroup){array_remove(logItems,group);group.remove(true,true);}}
|
82
|
+
logEntriesAndSeparators=array_removeFromStart(logEntriesAndSeparators,numberToDelete);return true;}
|
83
|
+
return false;}
|
84
|
+
function group(name,startExpanded){if(loggingEnabled){initiallyExpanded=(typeof startExpanded==="undefined")?true:Boolean(startExpanded);var newGroup=new Group(name,false,initiallyExpanded);currentGroup.addChild(newGroup);currentGroup=newGroup;logItems.push(newGroup);if(loaded){if(logQueuedEventsTimer!==null){clearTimeout(logQueuedEventsTimer);}
|
85
|
+
logQueuedEventsTimer=setTimeout(renderQueuedLogItems,renderDelay);unrenderedLogItemsExist=true;}}}
|
86
|
+
function groupEnd(){currentGroup=(currentGroup===rootGroup)?rootGroup:currentGroup.group;}
|
87
|
+
function mainPageReloaded(){currentGroup=rootGroup;var separator=new Separator();logEntriesAndSeparators.push(separator);logItems.push(separator);currentGroup.addChild(separator);}
|
88
|
+
function closeWindow(){if(appender&&mainWindowExists()){appender.close(true);}else{window.close();}}
|
89
|
+
function hide(){if(appender&&mainWindowExists()){appender.hide();}}
|
90
|
+
var mainWindow=window;var windowId="log4javascriptConsoleWindow_"+new Date().getTime()+"_"+(""+Math.random()).substr(2);function setMainWindow(win){mainWindow=win;mainWindow[windowId]=window;if(opener&&closeIfOpenerCloses){pollOpener();}}
|
91
|
+
function pollOpener(){if(closeIfOpenerCloses){if(mainWindowExists()){setTimeout(pollOpener,500);}else{closeWindow();}}}
|
92
|
+
function mainWindowExists(){try{return(mainWindow&&!mainWindow.closed&&mainWindow[windowId]==window);}catch(ex){}
|
93
|
+
return false;}
|
94
|
+
var logLevels=["TRACE","DEBUG","INFO","WARN","ERROR","FATAL"];function getCheckBox(logLevel){return $("switch_"+logLevel);}
|
95
|
+
function getIeWrappedLogContainer(){return $("log_wrapped");}
|
96
|
+
function getIeUnwrappedLogContainer(){return $("log_unwrapped");}
|
97
|
+
function applyFilters(){for(var i=0;i<logLevels.length;i++){if(getCheckBox(logLevels[i]).checked){addClass(logMainContainer,logLevels[i]);}else{removeClass(logMainContainer,logLevels[i]);}}
|
98
|
+
updateSearchFromFilters();}
|
99
|
+
function toggleAllLevels(){var turnOn=$("switch_ALL").checked;for(var i=0;i<logLevels.length;i++){getCheckBox(logLevels[i]).checked=turnOn;if(turnOn){addClass(logMainContainer,logLevels[i]);}else{removeClass(logMainContainer,logLevels[i]);}}}
|
100
|
+
function checkAllLevels(){for(var i=0;i<logLevels.length;i++){if(!getCheckBox(logLevels[i]).checked){getCheckBox("ALL").checked=false;return;}}
|
101
|
+
getCheckBox("ALL").checked=true;}
|
102
|
+
function clearLog(){rootGroup.clear();currentGroup=rootGroup;logEntries=[];logItems=[];logEntriesAndSeparators=[];doSearch();}
|
103
|
+
function toggleWrap(){var enable=$("wrap").checked;if(enable){addClass(logMainContainer,"wrap");}else{removeClass(logMainContainer,"wrap");}
|
104
|
+
refreshCurrentMatch();}
|
105
|
+
var searchTimer=null;function scheduleSearch(){try{clearTimeout(searchTimer);}catch(ex){}
|
106
|
+
searchTimer=setTimeout(doSearch,500);}
|
107
|
+
function Search(searchTerm,isRegex,searchRegex,isCaseSensitive){this.searchTerm=searchTerm;this.isRegex=isRegex;this.searchRegex=searchRegex;this.isCaseSensitive=isCaseSensitive;this.matches=[];}
|
108
|
+
Search.prototype={hasMatches:function(){return this.matches.length>0;},hasVisibleMatches:function(){if(this.hasMatches()){for(var i=0;i<this.matches.length;i++){if(this.matches[i].isVisible()){return true;}}}
|
109
|
+
return false;},match:function(logEntry){var entryText=String(logEntry.formattedMessage);var matchesSearch=false;if(this.isRegex){matchesSearch=this.searchRegex.test(entryText);}else if(this.isCaseSensitive){matchesSearch=(entryText.indexOf(this.searchTerm)>-1);}else{matchesSearch=(entryText.toLowerCase().indexOf(this.searchTerm.toLowerCase())>-1);}
|
110
|
+
return matchesSearch;},getNextVisibleMatchIndex:function(){for(var i=currentMatchIndex+1;i<this.matches.length;i++){if(this.matches[i].isVisible()){return i;}}
|
111
|
+
for(i=0;i<=currentMatchIndex;i++){if(this.matches[i].isVisible()){return i;}}
|
112
|
+
return-1;},getPreviousVisibleMatchIndex:function(){for(var i=currentMatchIndex-1;i>=0;i--){if(this.matches[i].isVisible()){return i;}}
|
113
|
+
for(var i=this.matches.length-1;i>=currentMatchIndex;i--){if(this.matches[i].isVisible()){return i;}}
|
114
|
+
return-1;},applyTo:function(logEntry){var doesMatch=this.match(logEntry);if(doesMatch){logEntry.group.expand();logEntry.setSearchMatch(true);var logEntryContent;var wrappedLogEntryContent;var searchTermReplacementStartTag="<span class=\"searchterm\">";var searchTermReplacementEndTag="<"+"/span>";var preTagName=isIe?"pre":"span";var preStartTag="<"+preTagName+" class=\"pre\">";var preEndTag="<"+"/"+preTagName+">";var startIndex=0;var searchIndex,matchedText,textBeforeMatch;if(this.isRegex){var flags=this.isCaseSensitive?"g":"gi";var capturingRegex=new RegExp("("+this.searchRegex.source+")",flags);var rnd=(""+Math.random()).substr(2);var startToken="%%s"+rnd+"%%";var endToken="%%e"+rnd+"%%";logEntryContent=logEntry.formattedMessage.replace(capturingRegex,startToken+"$1"+endToken);logEntryContent=escapeHtml(logEntryContent);var result;var searchString=logEntryContent;logEntryContent="";wrappedLogEntryContent="";while((searchIndex=searchString.indexOf(startToken,startIndex))>-1){var endTokenIndex=searchString.indexOf(endToken,searchIndex);matchedText=searchString.substring(searchIndex+startToken.length,endTokenIndex);textBeforeMatch=searchString.substring(startIndex,searchIndex);logEntryContent+=preStartTag+textBeforeMatch+preEndTag;logEntryContent+=searchTermReplacementStartTag+preStartTag+matchedText+
|
115
|
+
preEndTag+searchTermReplacementEndTag;if(isIe){wrappedLogEntryContent+=textBeforeMatch+searchTermReplacementStartTag+
|
116
|
+
matchedText+searchTermReplacementEndTag;}
|
117
|
+
startIndex=endTokenIndex+endToken.length;}
|
118
|
+
logEntryContent+=preStartTag+searchString.substr(startIndex)+preEndTag;if(isIe){wrappedLogEntryContent+=searchString.substr(startIndex);}}else{logEntryContent="";wrappedLogEntryContent="";var searchTermReplacementLength=searchTermReplacementStartTag.length+
|
119
|
+
this.searchTerm.length+searchTermReplacementEndTag.length;var searchTermLength=this.searchTerm.length;var searchTermLowerCase=this.searchTerm.toLowerCase();var logTextLowerCase=logEntry.formattedMessage.toLowerCase();while((searchIndex=logTextLowerCase.indexOf(searchTermLowerCase,startIndex))>-1){matchedText=escapeHtml(logEntry.formattedMessage.substr(searchIndex,this.searchTerm.length));textBeforeMatch=escapeHtml(logEntry.formattedMessage.substring(startIndex,searchIndex));var searchTermReplacement=searchTermReplacementStartTag+
|
120
|
+
preStartTag+matchedText+preEndTag+searchTermReplacementEndTag;logEntryContent+=preStartTag+textBeforeMatch+preEndTag+searchTermReplacement;if(isIe){wrappedLogEntryContent+=textBeforeMatch+searchTermReplacementStartTag+
|
121
|
+
matchedText+searchTermReplacementEndTag;}
|
122
|
+
startIndex=searchIndex+searchTermLength;}
|
123
|
+
var textAfterLastMatch=escapeHtml(logEntry.formattedMessage.substr(startIndex));logEntryContent+=preStartTag+textAfterLastMatch+preEndTag;if(isIe){wrappedLogEntryContent+=textAfterLastMatch;}}
|
124
|
+
logEntry.setContent(logEntryContent,wrappedLogEntryContent);var logEntryMatches=logEntry.getSearchMatches();this.matches=this.matches.concat(logEntryMatches);}else{logEntry.setSearchMatch(false);logEntry.setContent(logEntry.formattedMessage,logEntry.formattedMessage);}
|
125
|
+
return doesMatch;},removeMatches:function(logEntries){var matchesToRemoveCount=0;var currentMatchRemoved=false;var matchesToRemove=[];var i,iLen,j,jLen;for(i=0,iLen=this.matches.length;i<iLen;i++){for(j=0,jLen=logEntries.length;j<jLen;j++){if(this.matches[i].belongsTo(logEntries[j])){matchesToRemove.push(this.matches[i]);if(i===currentMatchIndex){currentMatchRemoved=true;}}}}
|
126
|
+
var newMatch=currentMatchRemoved?null:this.matches[currentMatchIndex];if(currentMatchRemoved){for(i=currentMatchIndex,iLen=this.matches.length;i<iLen;i++){if(this.matches[i].isVisible()&&!array_contains(matchesToRemove,this.matches[i])){newMatch=this.matches[i];break;}}}
|
127
|
+
for(i=0,iLen=matchesToRemove.length;i<iLen;i++){array_remove(this.matches,matchesToRemove[i]);matchesToRemove[i].remove();}
|
128
|
+
if(this.hasVisibleMatches()){if(newMatch===null){setCurrentMatchIndex(0);}else{var newMatchIndex=0;for(i=0,iLen=this.matches.length;i<iLen;i++){if(newMatch===this.matches[i]){newMatchIndex=i;break;}}
|
129
|
+
setCurrentMatchIndex(newMatchIndex);}}else{currentMatchIndex=null;displayNoMatches();}}};function getPageOffsetTop(el,container){var currentEl=el;var y=0;while(currentEl&¤tEl!=container){y+=currentEl.offsetTop;currentEl=currentEl.offsetParent;}
|
130
|
+
return y;}
|
131
|
+
function scrollIntoView(el){var logContainer=logMainContainer;if(!$("wrap").checked){var logContainerLeft=logContainer.scrollLeft;var logContainerRight=logContainerLeft+logContainer.offsetWidth;var elLeft=el.offsetLeft;var elRight=elLeft+el.offsetWidth;if(elLeft<logContainerLeft||elRight>logContainerRight){logContainer.scrollLeft=elLeft-(logContainer.offsetWidth-el.offsetWidth)/2;}}
|
132
|
+
var logContainerTop=logContainer.scrollTop;var logContainerBottom=logContainerTop+logContainer.offsetHeight;var elTop=getPageOffsetTop(el)-getToolBarsHeight();var elBottom=elTop+el.offsetHeight;if(elTop<logContainerTop||elBottom>logContainerBottom){logContainer.scrollTop=elTop-(logContainer.offsetHeight-el.offsetHeight)/2;}}
|
133
|
+
function Match(logEntryLevel,spanInMainDiv,spanInUnwrappedPre,spanInWrappedDiv){this.logEntryLevel=logEntryLevel;this.spanInMainDiv=spanInMainDiv;if(isIe){this.spanInUnwrappedPre=spanInUnwrappedPre;this.spanInWrappedDiv=spanInWrappedDiv;}
|
134
|
+
this.mainSpan=isIe?spanInUnwrappedPre:spanInMainDiv;}
|
135
|
+
Match.prototype={equals:function(match){return this.mainSpan===match.mainSpan;},setCurrent:function(){if(isIe){addClass(this.spanInUnwrappedPre,"currentmatch");addClass(this.spanInWrappedDiv,"currentmatch");var elementToScroll=$("wrap").checked?this.spanInWrappedDiv:this.spanInUnwrappedPre;scrollIntoView(elementToScroll);}else{addClass(this.spanInMainDiv,"currentmatch");scrollIntoView(this.spanInMainDiv);}},belongsTo:function(logEntry){if(isIe){return isDescendant(this.spanInUnwrappedPre,logEntry.unwrappedPre);}else{return isDescendant(this.spanInMainDiv,logEntry.mainDiv);}},setNotCurrent:function(){if(isIe){removeClass(this.spanInUnwrappedPre,"currentmatch");removeClass(this.spanInWrappedDiv,"currentmatch");}else{removeClass(this.spanInMainDiv,"currentmatch");}},isOrphan:function(){return isOrphan(this.mainSpan);},isVisible:function(){return getCheckBox(this.logEntryLevel).checked;},remove:function(){if(isIe){this.spanInUnwrappedPre=null;this.spanInWrappedDiv=null;}else{this.spanInMainDiv=null;}}};var currentSearch=null;var currentMatchIndex=null;function doSearch(){var searchBox=$("searchBox");var searchTerm=searchBox.value;var isRegex=$("searchRegex").checked;var isCaseSensitive=$("searchCaseSensitive").checked;var i;if(searchTerm===""){$("searchReset").disabled=true;$("searchNav").style.display="none";removeClass(document.body,"searching");removeClass(searchBox,"hasmatches");removeClass(searchBox,"nomatches");for(i=0;i<logEntries.length;i++){logEntries[i].clearSearch();logEntries[i].setContent(logEntries[i].formattedMessage,logEntries[i].formattedMessage);}
|
136
|
+
currentSearch=null;setLogContainerHeight();}else{$("searchReset").disabled=false;$("searchNav").style.display="block";var searchRegex;var regexValid;if(isRegex){try{searchRegex=isCaseSensitive?new RegExp(searchTerm,"g"):new RegExp(searchTerm,"gi");regexValid=true;replaceClass(searchBox,"validregex","invalidregex");searchBox.title="Valid regex";}catch(ex){regexValid=false;replaceClass(searchBox,"invalidregex","validregex");searchBox.title="Invalid regex: "+(ex.message?ex.message:(ex.description?ex.description:"unknown error"));return;}}else{searchBox.title="";removeClass(searchBox,"validregex");removeClass(searchBox,"invalidregex");}
|
137
|
+
addClass(document.body,"searching");currentSearch=new Search(searchTerm,isRegex,searchRegex,isCaseSensitive);for(i=0;i<logEntries.length;i++){currentSearch.applyTo(logEntries[i]);}
|
138
|
+
setLogContainerHeight();if(currentSearch.hasVisibleMatches()){setCurrentMatchIndex(0);displayMatches();}else{displayNoMatches();}}}
|
139
|
+
function updateSearchFromFilters(){if(currentSearch){if(currentSearch.hasMatches()){if(currentMatchIndex===null){currentMatchIndex=0;}
|
140
|
+
var currentMatch=currentSearch.matches[currentMatchIndex];if(currentMatch.isVisible()){displayMatches();setCurrentMatchIndex(currentMatchIndex);}else{currentMatch.setNotCurrent();var nextVisibleMatchIndex=currentSearch.getNextVisibleMatchIndex();if(nextVisibleMatchIndex>-1){setCurrentMatchIndex(nextVisibleMatchIndex);displayMatches();}else{displayNoMatches();}}}else{displayNoMatches();}}}
|
141
|
+
function refreshCurrentMatch(){if(currentSearch&¤tSearch.hasVisibleMatches()){setCurrentMatchIndex(currentMatchIndex);}}
|
142
|
+
function displayMatches(){replaceClass($("searchBox"),"hasmatches","nomatches");$("searchBox").title=""+currentSearch.matches.length+" matches found";$("searchNav").style.display="block";setLogContainerHeight();}
|
143
|
+
function displayNoMatches(){replaceClass($("searchBox"),"nomatches","hasmatches");$("searchBox").title="No matches found";$("searchNav").style.display="none";setLogContainerHeight();}
|
144
|
+
function toggleSearchEnabled(enable){enable=(typeof enable=="undefined")?!$("searchDisable").checked:enable;$("searchBox").disabled=!enable;$("searchReset").disabled=!enable;$("searchRegex").disabled=!enable;$("searchNext").disabled=!enable;$("searchPrevious").disabled=!enable;$("searchCaseSensitive").disabled=!enable;$("searchNav").style.display=(enable&&($("searchBox").value!=="")&¤tSearch&¤tSearch.hasVisibleMatches())?"block":"none";if(enable){removeClass($("search"),"greyedout");addClass(document.body,"searching");if($("searchHighlight").checked){addClass(logMainContainer,"searchhighlight");}else{removeClass(logMainContainer,"searchhighlight");}
|
145
|
+
if($("searchFilter").checked){addClass(logMainContainer,"searchfilter");}else{removeClass(logMainContainer,"searchfilter");}
|
146
|
+
$("searchDisable").checked=!enable;}else{addClass($("search"),"greyedout");removeClass(document.body,"searching");removeClass(logMainContainer,"searchhighlight");removeClass(logMainContainer,"searchfilter");}
|
147
|
+
setLogContainerHeight();}
|
148
|
+
function toggleSearchFilter(){var enable=$("searchFilter").checked;if(enable){addClass(logMainContainer,"searchfilter");}else{removeClass(logMainContainer,"searchfilter");}
|
149
|
+
refreshCurrentMatch();}
|
150
|
+
function toggleSearchHighlight(){var enable=$("searchHighlight").checked;if(enable){addClass(logMainContainer,"searchhighlight");}else{removeClass(logMainContainer,"searchhighlight");}}
|
151
|
+
function clearSearch(){$("searchBox").value="";doSearch();}
|
152
|
+
function searchNext(){if(currentSearch!==null&¤tMatchIndex!==null){currentSearch.matches[currentMatchIndex].setNotCurrent();var nextMatchIndex=currentSearch.getNextVisibleMatchIndex();if(nextMatchIndex>currentMatchIndex||confirm("Reached the end of the page. Start from the top?")){setCurrentMatchIndex(nextMatchIndex);}}}
|
153
|
+
function searchPrevious(){if(currentSearch!==null&¤tMatchIndex!==null){currentSearch.matches[currentMatchIndex].setNotCurrent();var previousMatchIndex=currentSearch.getPreviousVisibleMatchIndex();if(previousMatchIndex<currentMatchIndex||confirm("Reached the start of the page. Continue from the bottom?")){setCurrentMatchIndex(previousMatchIndex);}}}
|
154
|
+
function setCurrentMatchIndex(index){currentMatchIndex=index;currentSearch.matches[currentMatchIndex].setCurrent();}
|
155
|
+
function addClass(el,cssClass){if(!hasClass(el,cssClass)){if(el.className){el.className+=" "+cssClass;}else{el.className=cssClass;}}}
|
156
|
+
function hasClass(el,cssClass){if(el.className){var classNames=el.className.split(" ");return array_contains(classNames,cssClass);}
|
157
|
+
return false;}
|
158
|
+
function removeClass(el,cssClass){if(hasClass(el,cssClass)){var existingClasses=el.className.split(" ");var newClasses=[];for(var i=0,len=existingClasses.length;i<len;i++){if(existingClasses[i]!=cssClass){newClasses[newClasses.length]=existingClasses[i];}}
|
159
|
+
el.className=newClasses.join(" ");}}
|
160
|
+
function replaceClass(el,newCssClass,oldCssClass){removeClass(el,oldCssClass);addClass(el,newCssClass);}
|
161
|
+
function getElementsByClass(el,cssClass,tagName){var elements=el.getElementsByTagName(tagName);var matches=[];for(var i=0,len=elements.length;i<len;i++){if(hasClass(elements[i],cssClass)){matches.push(elements[i]);}}
|
162
|
+
return matches;}
|
163
|
+
function $(id){return document.getElementById(id);}
|
164
|
+
function isDescendant(node,ancestorNode){while(node!=null){if(node===ancestorNode){return true;}
|
165
|
+
node=node.parentNode;}
|
166
|
+
return false;}
|
167
|
+
function isOrphan(node){var currentNode=node;while(currentNode){if(currentNode==document.body){return false;}
|
168
|
+
currentNode=currentNode.parentNode;}
|
169
|
+
return true;}
|
170
|
+
function escapeHtml(str){return str.replace(/&/g,"&").replace(/[<]/g,"<").replace(/>/g,">");}
|
171
|
+
function getWindowWidth(){if(window.innerWidth){return window.innerWidth;}else if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth;}else if(document.body){return document.body.clientWidth;}
|
172
|
+
return 0;}
|
173
|
+
function getWindowHeight(){if(window.innerHeight){return window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight;}else if(document.body){return document.body.clientHeight;}
|
174
|
+
return 0;}
|
175
|
+
function getToolBarsHeight(){return $("switches").offsetHeight;}
|
176
|
+
function getChromeHeight(){var height=getToolBarsHeight();if(showCommandLine){height+=$("commandLine").offsetHeight;}
|
177
|
+
return height;}
|
178
|
+
function setLogContainerHeight(){if(logMainContainer){var windowHeight=getWindowHeight();$("body").style.height=getWindowHeight()+"px";logMainContainer.style.height=""+
|
179
|
+
Math.max(0,windowHeight-getChromeHeight())+"px";}}
|
180
|
+
function setCommandInputWidth(){if(showCommandLine){$("command").style.width=""+Math.max(0,$("commandLineContainer").offsetWidth-
|
181
|
+
($("evaluateButton").offsetWidth+13))+"px";}}
|
182
|
+
window.onresize=function(){setCommandInputWidth();setLogContainerHeight();};if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0,len=arguments.length;i<len;i++){this[this.length]=arguments[i];}
|
183
|
+
return this.length;};}
|
184
|
+
if(!Array.prototype.pop){Array.prototype.pop=function(){if(this.length>0){var val=this[this.length-1];this.length=this.length-1;return val;}};}
|
185
|
+
if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0,len=this.length-1;i<len;i++){this[i]=this[i+1];}
|
186
|
+
this.length=this.length-1;return firstItem;}};}
|
187
|
+
if(!Array.prototype.splice){Array.prototype.splice=function(startIndex,deleteCount){var itemsAfterDeleted=this.slice(startIndex+deleteCount);var itemsDeleted=this.slice(startIndex,startIndex+deleteCount);this.length=startIndex;var argumentsArray=[];for(var i=0,len=arguments.length;i<len;i++){argumentsArray[i]=arguments[i];}
|
188
|
+
var itemsToAppend=(argumentsArray.length>2)?itemsAfterDeleted=argumentsArray.slice(2).concat(itemsAfterDeleted):itemsAfterDeleted;for(i=0,len=itemsToAppend.length;i<len;i++){this.push(itemsToAppend[i]);}
|
189
|
+
return itemsDeleted;};}
|
190
|
+
function array_remove(arr,val){var index=-1;for(var i=0,len=arr.length;i<len;i++){if(arr[i]===val){index=i;break;}}
|
191
|
+
if(index>=0){arr.splice(index,1);return index;}else{return false;}}
|
192
|
+
function array_removeFromStart(array,numberToRemove){if(Array.prototype.splice){array.splice(0,numberToRemove);}else{for(var i=numberToRemove,len=array.length;i<len;i++){array[i-numberToRemove]=array[i];}
|
193
|
+
array.length=array.length-numberToRemove;}
|
194
|
+
return array;}
|
195
|
+
function array_contains(arr,val){for(var i=0,len=arr.length;i<len;i++){if(arr[i]==val){return true;}}
|
196
|
+
return false;}
|
197
|
+
function getErrorMessage(ex){if(ex.message){return ex.message;}else if(ex.description){return ex.description;}
|
198
|
+
return""+ex;}
|
199
|
+
function moveCaretToEnd(input){if(input.setSelectionRange){input.focus();var length=input.value.length;input.setSelectionRange(length,length);}else if(input.createTextRange){var range=input.createTextRange();range.collapse(false);range.select();}
|
200
|
+
input.focus();}
|
201
|
+
function stopPropagation(evt){if(evt.stopPropagation){evt.stopPropagation();}else if(typeof evt.cancelBubble!="undefined"){evt.cancelBubble=true;}}
|
202
|
+
function getEvent(evt){return evt?evt:event;}
|
203
|
+
function getTarget(evt){return evt.target?evt.target:evt.srcElement;}
|
204
|
+
function getRelatedTarget(evt){if(evt.relatedTarget){return evt.relatedTarget;}else if(evt.srcElement){switch(evt.type){case"mouseover":return evt.fromElement;case"mouseout":return evt.toElement;default:return evt.srcElement;}}}
|
205
|
+
function cancelKeyEvent(evt){evt.returnValue=false;stopPropagation(evt);}
|
206
|
+
function evalCommandLine(){var expr=$("command").value;evalCommand(expr);$("command").value="";}
|
207
|
+
function evalLastCommand(){if(lastCommand!=null){evalCommand(lastCommand);}}
|
208
|
+
var lastCommand=null;var commandHistory=[];var currentCommandIndex=0;function evalCommand(expr){if(appender){appender.evalCommandAndAppend(expr);}else{var prefix=">>> "+expr+"\r\n";try{log("INFO",prefix+eval(expr));}catch(ex){log("ERROR",prefix+"Error: "+getErrorMessage(ex));}}
|
209
|
+
if(expr!=commandHistory[commandHistory.length-1]){commandHistory.push(expr);if(appender){appender.storeCommandHistory(commandHistory);}}
|
210
|
+
currentCommandIndex=(expr==commandHistory[currentCommandIndex])?currentCommandIndex+1:commandHistory.length;lastCommand=expr;}
|
211
|
+
//]]>
|
212
|
+
</script>
|
213
|
+
<style type="text/css">
|
214
|
+
body{background-color:white;color:black;padding:0;margin:0;font-family:tahoma,verdana,arial,helvetica,sans-serif;overflow:hidden}div#switchesContainer input{margin-bottom:0}div.toolbar{border-top:solid #ffffff 1px;border-bottom:solid #aca899 1px;background-color:#f1efe7;padding:3px 5px;font-size:68.75%}div.toolbar,div#search input{font-family:tahoma,verdana,arial,helvetica,sans-serif}div.toolbar input.button{padding:0 5px;font-size:100%}div.toolbar input.hidden{display:none}div#switches input#clearButton{margin-left:20px}div#levels label{font-weight:bold}div#levels label,div#options label{margin-right:5px}div#levels label#wrapLabel{font-weight:normal}div#search label{margin-right:10px}div#search label.searchboxlabel{margin-right:0}div#search input{font-size:100%}div#search input.validregex{color:green}div#search input.invalidregex{color:red}div#search input.nomatches{color:white;background-color:#ff6666}div#search input.nomatches{color:white;background-color:#ff6666}div#searchNav{display:none}div#commandLine{display:none}div#commandLine input#command{font-size:100%;font-family:Courier New,Courier}div#commandLine input#evaluateButton{}*.greyedout{color:gray !important;border-color:gray !important}*.greyedout *.alwaysenabled{color:black}*.unselectable{-khtml-user-select:none;-moz-user-select:none;user-select:none}div#log{font-family:Courier New,Courier;font-size:75%;width:100%;overflow:auto;clear:both;position:relative}div.group{border-color:#cccccc;border-style:solid;border-width:1px 0 1px 1px;overflow:visible}div.oldIe div.group,div.oldIe div.group *,div.oldIe *.logentry{height:1%}div.group div.groupheading span.expander{border:solid black 1px;font-family:Courier New,Courier;font-size:0.833em;background-color:#eeeeee;position:relative;top:-1px;color:black;padding:0 2px;cursor:pointer;cursor:hand;height:1%}div.group div.groupcontent{margin-left:10px;padding-bottom:2px;overflow:visible}div.group div.expanded{display:block}div.group div.collapsed{display:none}*.logentry{overflow:visible;display:none;white-space:pre}span.pre{white-space:pre}pre.unwrapped{display:inline !important}pre.unwrapped pre.pre,div.wrapped pre.pre{display:inline}div.wrapped pre.pre{white-space:normal}div.wrapped{display:none}body.searching *.logentry span.currentmatch{color:white !important;background-color:green !important}body.searching div.searchhighlight *.logentry span.searchterm{color:black;background-color:yellow}div.wrap *.logentry{white-space:normal !important;border-width:0 0 1px 0;border-color:#dddddd;border-style:dotted}div.wrap #log_wrapped,#log_unwrapped{display:block}div.wrap #log_unwrapped,#log_wrapped{display:none}div.wrap *.logentry span.pre{overflow:visible;white-space:normal}div.wrap *.logentry pre.unwrapped{display:none}div.wrap *.logentry span.wrapped{display:inline}div.searchfilter *.searchnonmatch{display:none !important}div#log *.TRACE,label#label_TRACE{color:#666666}div#log *.DEBUG,label#label_DEBUG{color:green}div#log *.INFO,label#label_INFO{color:#000099}div#log *.WARN,label#label_WARN{color:#999900}div#log *.ERROR,label#label_ERROR{color:red}div#log *.FATAL,label#label_FATAL{color:#660066}div.TRACE#log *.TRACE,div.DEBUG#log *.DEBUG,div.INFO#log *.INFO,div.WARN#log *.WARN,div.ERROR#log *.ERROR,div.FATAL#log *.FATAL{display:block}div#log div.separator{background-color:#cccccc;margin:5px 0;line-height:1px}
|
215
|
+
</style>
|
216
|
+
</head>
|
217
|
+
<body id="body">
|
218
|
+
<div id="switchesContainer">
|
219
|
+
<div id="switches">
|
220
|
+
<div id="levels" class="toolbar">
|
221
|
+
Filters:
|
222
|
+
<input type="checkbox" id="switch_TRACE" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide trace messages" /><label for="switch_TRACE" id="label_TRACE">trace</label>
|
223
|
+
<input type="checkbox" id="switch_DEBUG" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide debug messages" /><label for="switch_DEBUG" id="label_DEBUG">debug</label>
|
224
|
+
<input type="checkbox" id="switch_INFO" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide info messages" /><label for="switch_INFO" id="label_INFO">info</label>
|
225
|
+
<input type="checkbox" id="switch_WARN" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide warn messages" /><label for="switch_WARN" id="label_WARN">warn</label>
|
226
|
+
<input type="checkbox" id="switch_ERROR" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide error messages" /><label for="switch_ERROR" id="label_ERROR">error</label>
|
227
|
+
<input type="checkbox" id="switch_FATAL" onclick="applyFilters(); checkAllLevels()" checked="checked" title="Show/hide fatal messages" /><label for="switch_FATAL" id="label_FATAL">fatal</label>
|
228
|
+
<input type="checkbox" id="switch_ALL" onclick="toggleAllLevels(); applyFilters()" checked="checked" title="Show/hide all messages" /><label for="switch_ALL" id="label_ALL">all</label>
|
229
|
+
</div>
|
230
|
+
<div id="search" class="toolbar">
|
231
|
+
<label for="searchBox" class="searchboxlabel">Search:</label> <input type="text" id="searchBox" onclick="toggleSearchEnabled(true)" onkeyup="scheduleSearch()" size="20" />
|
232
|
+
<input type="button" id="searchReset" disabled="disabled" value="Reset" onclick="clearSearch()" class="button" title="Reset the search" />
|
233
|
+
<input type="checkbox" id="searchRegex" onclick="doSearch()" title="If checked, search is treated as a regular expression" /><label for="searchRegex">Regex</label>
|
234
|
+
<input type="checkbox" id="searchCaseSensitive" onclick="doSearch()" title="If checked, search is case sensitive" /><label for="searchCaseSensitive">Match case</label>
|
235
|
+
<input type="checkbox" id="searchDisable" onclick="toggleSearchEnabled()" title="Enable/disable search" /><label for="searchDisable" class="alwaysenabled">Disable</label>
|
236
|
+
<div id="searchNav">
|
237
|
+
<input type="button" id="searchNext" disabled="disabled" value="Next" onclick="searchNext()" class="button" title="Go to the next matching log entry" />
|
238
|
+
<input type="button" id="searchPrevious" disabled="disabled" value="Previous" onclick="searchPrevious()" class="button" title="Go to the previous matching log entry" />
|
239
|
+
<input type="checkbox" id="searchFilter" onclick="toggleSearchFilter()" title="If checked, non-matching log entries are filtered out" /><label for="searchFilter">Filter</label>
|
240
|
+
<input type="checkbox" id="searchHighlight" onclick="toggleSearchHighlight()" title="Highlight matched search terms" /><label for="searchHighlight" class="alwaysenabled">Highlight all</label>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
<div id="options" class="toolbar">
|
244
|
+
Options:
|
245
|
+
<input type="checkbox" id="enableLogging" onclick="toggleLoggingEnabled()" checked="checked" title="Enable/disable logging" /><label for="enableLogging" id="enableLoggingLabel">Log</label>
|
246
|
+
<input type="checkbox" id="wrap" onclick="toggleWrap()" title="Enable / disable word wrap" /><label for="wrap" id="wrapLabel">Wrap</label>
|
247
|
+
<input type="checkbox" id="newestAtTop" onclick="toggleNewestAtTop()" title="If checked, causes newest messages to appear at the top" /><label for="newestAtTop" id="newestAtTopLabel">Newest at the top</label>
|
248
|
+
<input type="checkbox" id="scrollToLatest" onclick="toggleScrollToLatest()" checked="checked" title="If checked, window automatically scrolls to a new message when it is added" /><label for="scrollToLatest" id="scrollToLatestLabel">Scroll to latest</label>
|
249
|
+
<input type="button" id="clearButton" value="Clear" onclick="clearLog()" class="button" title="Clear all log messages" />
|
250
|
+
<input type="button" id="hideButton" value="Hide" onclick="hide()" class="hidden button" title="Hide the console" />
|
251
|
+
<input type="button" id="closeButton" value="Close" onclick="closeWindow()" class="hidden button" title="Close the window" />
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
<div id="log" class="TRACE DEBUG INFO WARN ERROR FATAL"></div>
|
256
|
+
<div id="commandLine" class="toolbar">
|
257
|
+
<div id="commandLineContainer">
|
258
|
+
<input type="text" id="command" title="Enter a JavaScript command here and hit return or press 'Evaluate'" />
|
259
|
+
<input type="button" id="evaluateButton" value="Evaluate" class="button" title="Evaluate the command" onclick="evalCommandLine()" />
|
260
|
+
</div>
|
261
|
+
</div>
|
262
|
+
</body>
|
263
|
+
</html>
|