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 | setLevel: f,
|
| 34 | getLevel: f,
|
| 35 | trace: f,
|
| 36 | debug: f,
|
| 37 | info: f,
|
| 38 | warn: f,
|
| 39 | error: f,
|
| 40 | fatal: f,
|
| 41 | isEnabledFor: f,
|
| 42 | isTraceEnabled: f,
|
| 43 | isDebugEnabled: f,
|
| 44 | isInfoEnabled: f,
|
| 45 | isWarnEnabled: f,
|
| 46 | isErrorEnabled: f,
|
| 47 | isFatalEnabled: f
|
| 48 | });
|
| 49 |
|
| 50 | var getLogger = function() {
|
| 51 | return new Logger();
|
| 52 | };
|
| 53 |
|
| 54 | function Log4JavaScript() {}
|
| 55 | log4javascript = new Log4JavaScript();
|
| 56 |
|
| 57 | log4javascript = {
|
| 58 | isStub: true,
|
| 59 | version: "1.4.6",
|
| 60 | edition: "log4javascript_lite",
|
| 61 | setEnabled: f,
|
| 62 | isEnabled: f,
|
| 63 | setShowStackTraces: f,
|
| 64 | getDefaultLogger: getLogger,
|
| 65 | getLogger: getLogger,
|
| 66 | getNullLogger: getLogger,
|
| 67 | Level: ff(),
|
| 68 | LoggingEvent: ff(),
|
| 69 | Appender: ff()
|
| 70 | };
|
| 71 |
|
| 72 | // LoggingEvents
|
| 73 | log4javascript.LoggingEvent.prototype = {
|
| 74 | getThrowableStrRep: f,
|
| 75 | getCombinedMessages: f
|
| 76 | };
|
| 77 |
|
| 78 | // Levels
|
| 79 | log4javascript.Level.prototype = {
|
| 80 | toString: f,
|
| 81 | equals: f,
|
| 82 | isGreaterOrEqual: f
|
| 83 | };
|
| 84 | var level = new log4javascript.Level();
|
| 85 | copy(log4javascript.Level, {
|
| 86 | ALL: level,
|
| 87 | TRACE: level,
|
| 88 | DEBUG: level,
|
| 89 | INFO: level,
|
| 90 | WARN: level,
|
| 91 | ERROR: level,
|
| 92 | FATAL: level,
|
| 93 | OFF: level
|
| 94 | });
|
| 95 |
|
| 96 | log4javascript.Appender.prototype.append = f;
|
| 97 |
|
| 98 | return log4javascript;
|
| 99 | })();
|
| 100 | if (typeof window.log4javascript == "undefined") {
|
| 101 | var log4javascript = log4javascript_stub;
|
| 102 | }
|