Siobhan Tully | e18b344 | 2014-02-23 14:23:34 -0500 | [diff] [blame] | 1 | /**
|
| 2 | * Copyright 2013 Tim Down.
|
| 3 | *
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 | * you may not use this file except in compliance with the License.
|
| 6 | * You may obtain a copy of the License at
|
| 7 | *
|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0
|
| 9 | *
|
| 10 | * Unless required by applicable law or agreed to in writing, software
|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 | * See the License for the specific language governing permissions and
|
| 14 | * limitations under the License.
|
| 15 | */
|
| 16 |
|
| 17 | var log4javascript_stub = (function() {
|
| 18 | var log4javascript;
|
| 19 |
|
| 20 | function ff() {
|
| 21 | return function() {};
|
| 22 | }
|
| 23 | function copy(obj, props) {
|
| 24 | for (var i in props) {
|
| 25 | obj[i] = props[i];
|
| 26 | }
|
| 27 | }
|
| 28 | var f = ff();
|
| 29 |
|
| 30 | // Loggers
|
| 31 | var Logger = ff();
|
| 32 | copy(Logger.prototype, {
|
| 33 | addChild: f,
|
| 34 | getEffectiveAppenders: f,
|
| 35 | invalidateAppenderCache: f,
|
| 36 | getAdditivity: f,
|
| 37 | setAdditivity: f,
|
| 38 | addAppender: f,
|
| 39 | removeAppender: f,
|
| 40 | removeAllAppenders: f,
|
| 41 | log: f,
|
| 42 | setLevel: f,
|
| 43 | getLevel: f,
|
| 44 | getEffectiveLevel: f,
|
| 45 | trace: f,
|
| 46 | debug: f,
|
| 47 | info: f,
|
| 48 | warn: f,
|
| 49 | error: f,
|
| 50 | fatal: f,
|
| 51 | isEnabledFor: f,
|
| 52 | isTraceEnabled: f,
|
| 53 | isDebugEnabled: f,
|
| 54 | isInfoEnabled: f,
|
| 55 | isWarnEnabled: f,
|
| 56 | isErrorEnabled: f,
|
| 57 | isFatalEnabled: f,
|
| 58 | callAppenders: f,
|
| 59 | group: f,
|
| 60 | groupEnd: f,
|
| 61 | time: f,
|
| 62 | timeEnd: f,
|
| 63 | assert: f,
|
| 64 | parent: new Logger()
|
| 65 | });
|
| 66 |
|
| 67 | var getLogger = function() {
|
| 68 | return new Logger();
|
| 69 | };
|
| 70 |
|
| 71 | function EventSupport() {}
|
| 72 |
|
| 73 | copy(EventSupport.prototype, {
|
| 74 | setEventTypes: f,
|
| 75 | addEventListener: f,
|
| 76 | removeEventListener: f,
|
| 77 | dispatchEvent: f,
|
| 78 | eventTypes: [],
|
| 79 | eventListeners: {}
|
| 80 | });
|
| 81 |
|
| 82 | function Log4JavaScript() {}
|
| 83 | Log4JavaScript.prototype = new EventSupport();
|
| 84 | log4javascript = new Log4JavaScript();
|
| 85 |
|
| 86 | log4javascript = {
|
| 87 | isStub: true,
|
| 88 | version: "1.4.6",
|
| 89 | edition: "log4javascript",
|
| 90 | setDocumentReady: f,
|
| 91 | setEventTypes: f,
|
| 92 | addEventListener: f,
|
| 93 | removeEventListener: f,
|
| 94 | dispatchEvent: f,
|
| 95 | eventTypes: [],
|
| 96 | eventListeners: {},
|
| 97 | logLog: {
|
| 98 | setQuietMode: f,
|
| 99 | setAlertAllErrors: f,
|
| 100 | debug: f,
|
| 101 | displayDebug: f,
|
| 102 | warn: f,
|
| 103 | error: f
|
| 104 | },
|
| 105 | handleError: f,
|
| 106 | setEnabled: f,
|
| 107 | isEnabled: f,
|
| 108 | setTimeStampsInMilliseconds: f,
|
| 109 | isTimeStampsInMilliseconds: f,
|
| 110 | evalInScope: f,
|
| 111 | setShowStackTraces: f,
|
| 112 | getLogger: getLogger,
|
| 113 | getDefaultLogger: getLogger,
|
| 114 | getNullLogger: getLogger,
|
| 115 | getRootLogger: getLogger,
|
| 116 | resetConfiguration: f,
|
| 117 | Level: ff(),
|
| 118 | LoggingEvent: ff(),
|
| 119 | Layout: ff(),
|
| 120 | Appender: ff()
|
| 121 | };
|
| 122 |
|
| 123 | // LoggingEvents
|
| 124 | log4javascript.LoggingEvent.prototype = {
|
| 125 | getThrowableStrRep: f,
|
| 126 | getCombinedMessages: f
|
| 127 | };
|
| 128 |
|
| 129 | // Levels
|
| 130 | log4javascript.Level.prototype = {
|
| 131 | toString: f,
|
| 132 | equals: f,
|
| 133 | isGreaterOrEqual: f
|
| 134 | };
|
| 135 | var level = new log4javascript.Level();
|
| 136 | copy(log4javascript.Level, {
|
| 137 | ALL: level,
|
| 138 | TRACE: level,
|
| 139 | DEBUG: level,
|
| 140 | INFO: level,
|
| 141 | WARN: level,
|
| 142 | ERROR: level,
|
| 143 | FATAL: level,
|
| 144 | OFF: level
|
| 145 | });
|
| 146 |
|
| 147 | // Layouts
|
| 148 | log4javascript.Layout.prototype = {
|
| 149 | defaults: {},
|
| 150 | format: f,
|
| 151 | ignoresThrowable: f,
|
| 152 | getContentType: f,
|
| 153 | allowBatching: f,
|
| 154 | getDataValues: f,
|
| 155 | setKeys: f,
|
| 156 | setCustomField: f,
|
| 157 | hasCustomFields: f,
|
| 158 | setTimeStampsInMilliseconds: f,
|
| 159 | isTimeStampsInMilliseconds: f,
|
| 160 | getTimeStampValue: f,
|
| 161 | toString: f
|
| 162 | };
|
| 163 |
|
| 164 | // PatternLayout related
|
| 165 | log4javascript.SimpleDateFormat = ff();
|
| 166 | log4javascript.SimpleDateFormat.prototype = {
|
| 167 | setMinimalDaysInFirstWeek: f,
|
| 168 | getMinimalDaysInFirstWeek: f,
|
| 169 | format: f
|
| 170 | };
|
| 171 |
|
| 172 | // PatternLayout
|
| 173 | log4javascript.PatternLayout = ff();
|
| 174 | log4javascript.PatternLayout.prototype = new log4javascript.Layout();
|
| 175 |
|
| 176 | // Appenders
|
| 177 | log4javascript.Appender = ff();
|
| 178 | log4javascript.Appender.prototype = new EventSupport();
|
| 179 |
|
| 180 | copy(log4javascript.Appender.prototype, {
|
| 181 | layout: new log4javascript.PatternLayout(),
|
| 182 | threshold: log4javascript.Level.ALL,
|
| 183 | loggers: [],
|
| 184 | doAppend: f,
|
| 185 | append: f,
|
| 186 | setLayout: f,
|
| 187 | getLayout: f,
|
| 188 | setThreshold: f,
|
| 189 | getThreshold: f,
|
| 190 | setAddedToLogger: f,
|
| 191 | setRemovedFromLogger: f,
|
| 192 | group: f,
|
| 193 | groupEnd: f,
|
| 194 | toString: f
|
| 195 | });
|
| 196 | // SimpleLayout
|
| 197 | log4javascript.SimpleLayout = ff();
|
| 198 | log4javascript.SimpleLayout.prototype = new log4javascript.Layout();
|
| 199 | // NullLayout
|
| 200 | log4javascript.NullLayout = ff();
|
| 201 | log4javascript.NullLayout.prototype = new log4javascript.Layout();
|
| 202 | // ZmlLayout
|
| 203 | log4javascript.XmlLayout = ff();
|
| 204 | log4javascript.XmlLayout.prototype = new log4javascript.Layout();
|
| 205 | copy(log4javascript.XmlLayout.prototype, {
|
| 206 | escapeCdata: f,
|
| 207 | isCombinedMessages: f
|
| 208 | });
|
| 209 | // JsonLayout
|
| 210 | log4javascript.JsonLayout = ff();
|
| 211 | log4javascript.JsonLayout.prototype = new log4javascript.Layout();
|
| 212 | copy(log4javascript.JsonLayout.prototype, {
|
| 213 | isReadable: f,
|
| 214 | isCombinedMessages: f
|
| 215 | });
|
| 216 | // HttpPostDataLayout
|
| 217 | log4javascript.HttpPostDataLayout = ff();
|
| 218 | log4javascript.HttpPostDataLayout.prototype = new log4javascript.Layout();
|
| 219 | // PatternLayout
|
| 220 | log4javascript.PatternLayout = ff();
|
| 221 | log4javascript.PatternLayout.prototype = new log4javascript.Layout();
|
| 222 | // AlertAppender
|
| 223 | log4javascript.AlertAppender = ff();
|
| 224 | log4javascript.AlertAppender.prototype = new log4javascript.Appender();
|
| 225 | // BrowserConsoleAppender
|
| 226 | log4javascript.BrowserConsoleAppender = ff();
|
| 227 | log4javascript.BrowserConsoleAppender.prototype = new log4javascript.Appender();
|
| 228 | // AjaxAppender
|
| 229 | log4javascript.AjaxAppender = ff();
|
| 230 | log4javascript.AjaxAppender.prototype = new log4javascript.Appender();
|
| 231 | copy(log4javascript.AjaxAppender.prototype, {
|
| 232 | getSessionId: f,
|
| 233 | setSessionId: f,
|
| 234 | isTimed: f,
|
| 235 | setTimed: f,
|
| 236 | getTimerInterval: f,
|
| 237 | setTimerInterval: f,
|
| 238 | isWaitForResponse: f,
|
| 239 | setWaitForResponse: f,
|
| 240 | getBatchSize: f,
|
| 241 | setBatchSize: f,
|
| 242 | isSendAllOnUnload: f,
|
| 243 | setSendAllOnUnload: f,
|
| 244 | setRequestSuccessCallback: f,
|
| 245 | setFailCallback: f,
|
| 246 | getPostVarName: f,
|
| 247 | setPostVarName: f,
|
| 248 | sendAll: f,
|
| 249 | sendAllRemaining: f,
|
| 250 | defaults: {
|
| 251 | requestSuccessCallback: null,
|
| 252 | failCallback: null
|
| 253 | }
|
| 254 | });
|
| 255 | // ConsoleAppender
|
| 256 | function ConsoleAppender() {}
|
| 257 | ConsoleAppender.prototype = new log4javascript.Appender();
|
| 258 | copy(ConsoleAppender.prototype, {
|
| 259 | create: f,
|
| 260 | isNewestMessageAtTop: f,
|
| 261 | setNewestMessageAtTop: f,
|
| 262 | isScrollToLatestMessage: f,
|
| 263 | setScrollToLatestMessage: f,
|
| 264 | getWidth: f,
|
| 265 | setWidth: f,
|
| 266 | getHeight: f,
|
| 267 | setHeight: f,
|
| 268 | getMaxMessages: f,
|
| 269 | setMaxMessages: f,
|
| 270 | isShowCommandLine: f,
|
| 271 | setShowCommandLine: f,
|
| 272 | isShowHideButton: f,
|
| 273 | setShowHideButton: f,
|
| 274 | isShowCloseButton: f,
|
| 275 | setShowCloseButton: f,
|
| 276 | getCommandLineObjectExpansionDepth: f,
|
| 277 | setCommandLineObjectExpansionDepth: f,
|
| 278 | isInitiallyMinimized: f,
|
| 279 | setInitiallyMinimized: f,
|
| 280 | isUseDocumentWrite: f,
|
| 281 | setUseDocumentWrite: f,
|
| 282 | group: f,
|
| 283 | groupEnd: f,
|
| 284 | clear: f,
|
| 285 | focus: f,
|
| 286 | focusCommandLine: f,
|
| 287 | focusSearch: f,
|
| 288 | getCommandWindow: f,
|
| 289 | setCommandWindow: f,
|
| 290 | executeLastCommand: f,
|
| 291 | getCommandLayout: f,
|
| 292 | setCommandLayout: f,
|
| 293 | evalCommandAndAppend: f,
|
| 294 | addCommandLineFunction: f,
|
| 295 | storeCommandHistory: f,
|
| 296 | unload: f
|
| 297 | });
|
| 298 |
|
| 299 | ConsoleAppender.addGlobalCommandLineFunction = f;
|
| 300 |
|
| 301 | // InPageAppender
|
| 302 | log4javascript.InPageAppender = ff();
|
| 303 | log4javascript.InPageAppender.prototype = new ConsoleAppender();
|
| 304 | copy(log4javascript.InPageAppender.prototype, {
|
| 305 | addCssProperty: f,
|
| 306 | hide: f,
|
| 307 | show: f,
|
| 308 | isVisible: f,
|
| 309 | close: f,
|
| 310 | defaults: {
|
| 311 | layout: new log4javascript.PatternLayout(),
|
| 312 | maxMessages: null
|
| 313 | }
|
| 314 | });
|
| 315 | log4javascript.InlineAppender = log4javascript.InPageAppender;
|
| 316 |
|
| 317 | // PopUpAppender
|
| 318 | log4javascript.PopUpAppender = ff();
|
| 319 | log4javascript.PopUpAppender.prototype = new ConsoleAppender();
|
| 320 | copy(log4javascript.PopUpAppender.prototype, {
|
| 321 | isUseOldPopUp: f,
|
| 322 | setUseOldPopUp: f,
|
| 323 | isComplainAboutPopUpBlocking: f,
|
| 324 | setComplainAboutPopUpBlocking: f,
|
| 325 | isFocusPopUp: f,
|
| 326 | setFocusPopUp: f,
|
| 327 | isReopenWhenClosed: f,
|
| 328 | setReopenWhenClosed: f,
|
| 329 | close: f,
|
| 330 | hide: f,
|
| 331 | show: f,
|
| 332 | defaults: {
|
| 333 | layout: new log4javascript.PatternLayout(),
|
| 334 | maxMessages: null
|
| 335 | }
|
| 336 | });
|
| 337 | return log4javascript;
|
| 338 | })();
|
| 339 | if (typeof window.log4javascript == "undefined") {
|
| 340 | var log4javascript = log4javascript_stub;
|
| 341 | }
|