forked from 0x2620/oxjs
fix a bug related to clearing the requests cache
This commit is contained in:
parent
45ad8ee468
commit
7415b72037
3 changed files with 23 additions and 13 deletions
|
|
@ -122,20 +122,30 @@ Ox.load = function() {
|
|||
};
|
||||
|
||||
Ox.Log = (function() {
|
||||
var filter = /*localStorage && localStorage.filter
|
||||
? new RegExp(localStorage.filter) || */'/.*?/',
|
||||
var filter = localStorage && localStorage.filter
|
||||
? JSON.parse(localStorage.filter) : 0,
|
||||
that = function() {
|
||||
Ox.Log.log.apply(null, arguments);
|
||||
return that;
|
||||
return that.log.apply(null, arguments);
|
||||
};
|
||||
that.filter = function(regexp) {
|
||||
filter = regexp;
|
||||
// ...
|
||||
};
|
||||
that.log = function() {
|
||||
if (filter.test(JSON.stringify(arguments))) {
|
||||
Ox.print.apply(null, arguments);
|
||||
that.filter = function(value) {
|
||||
filter = value;
|
||||
if (localStorage) {
|
||||
localStorage.filter = JSON.stringify(filter);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
that.log = function log() {
|
||||
var args = Ox.makeArray(arguments),
|
||||
level = Ox.isNumber(args[0]) ? args[0] : 0,
|
||||
ret;
|
||||
if ((Ox.isNumber(filter) && level >= filter) || filter === args[0]) {
|
||||
args.unshift(
|
||||
(arguments.callee.caller && arguments.callee.caller.name)
|
||||
|| '(anonymous)'
|
||||
);
|
||||
ret = Ox.print.apply(null, args);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
return that;
|
||||
}());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue