~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to html/MochiKit/Logging.js

  • Committer: Bazaar Package Importer
  • Author(s): Ludovico Cavedon, Jordan Metzmeier, Ludovico Cavedon
  • Date: 2010-12-15 20:06:19 UTC
  • mfrom: (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20101215200619-0ojz3iak95ihibun
Tags: 3:4.0.3+dfsg1-1
[ Jordan Metzmeier ]
* New upstream release (Closes: #522042)
* Move data files to /usr/share/ntop (Closes: #595450).
* Package architecture independent data in a separate ntop-data package.
* Use debhelper 7.
* Update Standards-Version to 3.9.1.
* Depend on python-mako.
* Do not include ntop.txt in binary packages as it is a copy of the man
  page.
* Do not include NEWS, as it is outdated.
* Switch to package source version 3.0 (quilt).
* Add password creation to debconf
* Changed init script to fix localization problems (thanks to Alejandro
  Varas <alej0varas@gmail.com>, LP: #257466)
* Remove manual update-rc.d calls from postrm and postinst. debhelper adds
  this for us.
* Add pre-depends on adduser for postinst script.
* Fix errors in the manpages: fix-manpage-errors.patch.
* Added fixes for matching active interfaces.
* Added a watch file.

[ Ludovico Cavedon ]
* Remove direct changes to upstream tree, and move them into specific patch
  files:
  - fix-manpage-errors.patch: fix typos in ntop.8.
  - dot-path.patch: fix path of /usr/bin/dot executable
* Add patches:
  - reduce-autogen-purged-files.patch: prevent agutogen.sh from reamoving
  too many files during cleanup.
  - Add build-without-ntop-darwin.patch, to fix compilation without
  ntop_darwin.c.
* No longer add faq.html, as it is not distributed in the upstream tarball.
* Use ${source:Version} in control file. Have ntop-data recommend
  ntop.
* Rename dirs to ntop.dirs and keep only empty directories that need
  to be created.
* Remove var/lib from ntop.install file, as it is empty (keeping it in
  ntop.dirs).
* Update po files.
* Breaks and Replaces instead of Conflitcs for ntop-data.
* Use a longer package description.
* Remove useless configure options from debian/rules.
* Move private shared libraries libraries in /usr/lib/ntop.
* Add change-plugin-dir.patch for adjusting plugin directory.
* Remove development files.
* Use system library for MochiKit.js.
* Rewrite DEP5 copyright file.
* Repackage upstream tarball in order to remove non-DFSG-compliant code. Add
  get-orig-source.sh script and get-orig-source target in debian/rules.
* Add explanation to README.Debian why geolocation is no longer working.
* Add avoid-copy-maxmind-db.patch to prevent copying of Geo*.dat
  files.
* Remove old unused patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***
2
2
 
3
 
MochiKit.Logging 1.3.1
 
3
MochiKit.Logging 1.4.2
4
4
 
5
5
See <http://mochikit.com/> for documentation, downloads, license, etc.
6
6
 
7
7
(c) 2005 Bob Ippolito.  All rights Reserved.
8
8
 
9
9
***/
10
 
if (typeof(dojo) != 'undefined') {
11
 
    dojo.provide('MochiKit.Logging');
12
 
    dojo.require('MochiKit.Base');
13
 
}
14
 
 
15
 
if (typeof(JSAN) != 'undefined') {
16
 
    JSAN.use("MochiKit.Base", []);
17
 
}
18
 
 
19
 
try {
20
 
    if (typeof(MochiKit.Base) == 'undefined') {
21
 
        throw "";
22
 
    }
23
 
} catch (e) {
24
 
    throw "MochiKit.Logging depends on MochiKit.Base!";
25
 
}
26
 
 
27
 
if (typeof(MochiKit.Logging) == 'undefined') {
28
 
    MochiKit.Logging = {};
29
 
}
 
10
 
 
11
MochiKit.Base._deps('Logging', ['Base']);
30
12
 
31
13
MochiKit.Logging.NAME = "MochiKit.Logging";
32
 
MochiKit.Logging.VERSION = "1.3.1";
 
14
MochiKit.Logging.VERSION = "1.4.2";
33
15
MochiKit.Logging.__repr__ = function () {
34
16
    return "[" + this.NAME + " " + this.VERSION + "]";
35
17
};
60
42
];
61
43
 
62
44
 
 
45
/** @id MochiKit.Logging.LogMessage */
63
46
MochiKit.Logging.LogMessage = function (num, level, info) {
64
47
    this.num = num;
65
48
    this.level = level;
68
51
};
69
52
 
70
53
MochiKit.Logging.LogMessage.prototype = {
 
54
     /** @id MochiKit.Logging.LogMessage.prototype.repr */
71
55
    repr: function () {
72
56
        var m = MochiKit.Base;
73
 
        return 'LogMessage(' + 
 
57
        return 'LogMessage(' +
74
58
            m.map(
75
59
                m.repr,
76
60
                [this.num, this.level, this.info]
77
61
            ).join(', ') + ')';
78
62
    },
 
63
    /** @id MochiKit.Logging.LogMessage.prototype.toString */
79
64
    toString: MochiKit.Base.forwardCall("repr")
80
65
};
81
66
 
82
67
MochiKit.Base.update(MochiKit.Logging, {
 
68
    /** @id MochiKit.Logging.logLevelAtLeast */
83
69
    logLevelAtLeast: function (minLevel) {
84
70
        var self = MochiKit.Logging;
85
71
        if (typeof(minLevel) == 'string') {
94
80
        };
95
81
    },
96
82
 
 
83
    /** @id MochiKit.Logging.isLogMessage */
97
84
    isLogMessage: function (/* ... */) {
98
85
        var LogMessage = MochiKit.Logging.LogMessage;
99
86
        for (var i = 0; i < arguments.length; i++) {
104
91
        return true;
105
92
    },
106
93
 
 
94
    /** @id MochiKit.Logging.compareLogMessage */
107
95
    compareLogMessage: function (a, b) {
108
96
        return MochiKit.Base.compare([a.level, a.info], [b.level, b.info]);
109
97
    },
110
98
 
 
99
    /** @id MochiKit.Logging.alertListener */
111
100
    alertListener: function (msg) {
112
101
        alert(
113
102
            "num: " + msg.num +
118
107
 
119
108
});
120
109
 
 
110
/** @id MochiKit.Logging.Logger */
121
111
MochiKit.Logging.Logger = function (/* optional */maxSize) {
122
112
    this.counter = 0;
123
113
    if (typeof(maxSize) == 'undefined' || maxSize === null) {
130
120
};
131
121
 
132
122
MochiKit.Logging.Logger.prototype = {
 
123
    /** @id MochiKit.Logging.Logger.prototype.clear */
133
124
    clear: function () {
134
125
        this._messages.splice(0, this._messages.length);
135
126
    },
136
127
 
 
128
    /** @id MochiKit.Logging.Logger.prototype.logToConsole */
137
129
    logToConsole: function (msg) {
138
130
        if (typeof(window) != "undefined" && window.console
139
131
                && window.console.log) {
140
 
            // Safari
141
 
            window.console.log(msg);
 
132
            // Safari and FireBug 0.4
 
133
            // Percent replacement is a workaround for cute Safari crashing bug
 
134
            window.console.log(msg.replace(/%/g, '\uFF05'));
142
135
        } else if (typeof(opera) != "undefined" && opera.postError) {
143
136
            // Opera
144
137
            opera.postError(msg);
145
138
        } else if (typeof(printfire) == "function") {
146
 
            // FireBug
 
139
            // FireBug 0.3 and earlier
147
140
            printfire(msg);
 
141
        } else if (typeof(Debug) != "undefined" && Debug.writeln) {
 
142
            // IE Web Development Helper (?)
 
143
            // http://www.nikhilk.net/Entry.aspx?id=93
 
144
            Debug.writeln(msg);
 
145
        } else if (typeof(debug) != "undefined" && debug.trace) {
 
146
            // Atlas framework (?)
 
147
            // http://www.nikhilk.net/Entry.aspx?id=93
 
148
            debug.trace(msg);
148
149
        }
149
150
    },
150
 
    
 
151
 
 
152
    /** @id MochiKit.Logging.Logger.prototype.dispatchListeners */
151
153
    dispatchListeners: function (msg) {
152
154
        for (var k in this.listeners) {
153
155
            var pair = this.listeners[k];
158
160
        }
159
161
    },
160
162
 
 
163
    /** @id MochiKit.Logging.Logger.prototype.addListener */
161
164
    addListener: function (ident, filter, listener) {
162
165
        if (typeof(filter) == 'string') {
163
166
            filter = MochiKit.Logging.logLevelAtLeast(filter);
167
170
        this.listeners[ident] = entry;
168
171
    },
169
172
 
 
173
    /** @id MochiKit.Logging.Logger.prototype.removeListener */
170
174
    removeListener: function (ident) {
171
175
        delete this.listeners[ident];
172
176
    },
173
177
 
 
178
    /** @id MochiKit.Logging.Logger.prototype.baseLog */
174
179
    baseLog: function (level, message/*, ...*/) {
 
180
        if (typeof(level) == "number") {
 
181
            if (level >= MochiKit.Logging.LogLevel.FATAL) {
 
182
                level = 'FATAL';
 
183
            } else if (level >= MochiKit.Logging.LogLevel.ERROR) {
 
184
                level = 'ERROR';
 
185
            } else if (level >= MochiKit.Logging.LogLevel.WARNING) {
 
186
                level = 'WARNING';
 
187
            } else if (level >= MochiKit.Logging.LogLevel.INFO) {
 
188
                level = 'INFO';
 
189
            } else {
 
190
                level = 'DEBUG';
 
191
            }
 
192
        }
175
193
        var msg = new MochiKit.Logging.LogMessage(
176
194
            this.counter,
177
195
            level,
188
206
        }
189
207
    },
190
208
 
 
209
    /** @id MochiKit.Logging.Logger.prototype.getMessages */
191
210
    getMessages: function (howMany) {
192
211
        var firstMsg = 0;
193
212
        if (!(typeof(howMany) == 'undefined' || howMany === null)) {
196
215
        return this._messages.slice(firstMsg);
197
216
    },
198
217
 
 
218
    /** @id MochiKit.Logging.Logger.prototype.getMessageText */
199
219
    getMessageText: function (howMany) {
200
220
        if (typeof(howMany) == 'undefined' || howMany === null) {
201
221
            howMany = 30;
203
223
        var messages = this.getMessages(howMany);
204
224
        if (messages.length) {
205
225
            var lst = map(function (m) {
206
 
                return '\n  [' + m.num + '] ' + m.level + ': ' + m.info.join(' '); 
 
226
                return '\n  [' + m.num + '] ' + m.level + ': ' + m.info.join(' ');
207
227
            }, messages);
208
228
            lst.unshift('LAST ' + messages.length + ' MESSAGES:');
209
229
            return lst.join('');
211
231
        return '';
212
232
    },
213
233
 
 
234
    /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */
214
235
    debuggingBookmarklet: function (inline) {
215
236
        if (typeof(MochiKit.LoggingPane) == "undefined") {
216
237
            alert(this.getMessageText());
220
241
    }
221
242
};
222
243
 
223
 
 
224
244
MochiKit.Logging.__new__ = function () {
225
245
    this.LogLevel = {
226
246
        ERROR: 40,
256
276
        };
257
277
    };
258
278
 
 
279
    /** @id MochiKit.Logging.log */
259
280
    this.log = connectLog('log');
 
281
    /** @id MochiKit.Logging.logError */
260
282
    this.logError = connectLog('error');
 
283
    /** @id MochiKit.Logging.logDebug */
261
284
    this.logDebug = connectLog('debug');
 
285
    /** @id MochiKit.Logging.logFatal */
262
286
    this.logFatal = connectLog('fatal');
 
287
    /** @id MochiKit.Logging.logWarning */
263
288
    this.logWarning = connectLog('warning');
264
289
    this.logger = new Logger();
265
290
    this.logger.useNativeConsole = true;