@@ -58,6 +58,11 @@ lib.extendFlat = extendModule.extendFlat;
58
58
lib . extendDeep = extendModule . extendDeep ;
59
59
lib . extendDeepAll = extendModule . extendDeepAll ;
60
60
61
+ var loggersModule = require ( './loggers' ) ;
62
+ lib . log = loggersModule . log ;
63
+ lib . warn = loggersModule . warn ;
64
+ lib . error = loggersModule . error ;
65
+
61
66
lib . notifier = require ( './notifier' ) ;
62
67
63
68
/**
@@ -92,35 +97,6 @@ lib.pauseEvent = function(e) {
92
97
return false ;
93
98
} ;
94
99
95
- /**
96
- * ------------------------------------------
97
- * debugging tools
98
- * ------------------------------------------
99
- */
100
-
101
- // set VERBOSE to true to get a lot more logging and tracing
102
- lib . VERBOSE = false ;
103
-
104
- // first markTime call will return time from page load
105
- lib . TIMER = new Date ( ) . getTime ( ) ;
106
-
107
- // console.log that only runs if VERBOSE is on
108
- lib . log = function ( ) {
109
- if ( lib . VERBOSE ) console . log . apply ( console , arguments ) ;
110
- } ;
111
-
112
- /**
113
- * markTime - for debugging, mark the number of milliseconds
114
- * since the previous call to markTime and log arbitrary info too
115
- */
116
- lib . markTime = function ( v ) {
117
- if ( ! lib . VERBOSE ) return ;
118
- var t2 = new Date ( ) . getTime ( ) ;
119
- console . log ( v , t2 - lib . TIMER , '(msec)' ) ;
120
- if ( lib . VERBOSE === 'trace' ) console . trace ( ) ;
121
- lib . TIMER = t2 ;
122
- } ;
123
-
124
100
// constrain - restrict a number v to be between v0 and v1
125
101
lib . constrain = function ( v , v0 , v1 ) {
126
102
if ( v0 > v1 ) return Math . max ( v1 , Math . min ( v0 , v ) ) ;
@@ -271,18 +247,17 @@ lib.syncOrAsync = function(sequence, arg, finalStep) {
271
247
var ret , fni ;
272
248
273
249
function continueAsync ( ) {
274
- lib . markTime ( 'async done ' + fni . name ) ;
275
250
return lib . syncOrAsync ( sequence , arg , finalStep ) ;
276
251
}
252
+
277
253
while ( sequence . length ) {
278
254
fni = sequence . splice ( 0 , 1 ) [ 0 ] ;
279
255
ret = fni ( arg ) ;
280
- // lib.markTime('done calling '+fni.name)
256
+
281
257
if ( ret && ret . then ) {
282
258
return ret . then ( continueAsync )
283
259
. then ( undefined , lib . promiseError ) ;
284
260
}
285
- lib . markTime ( 'sync done ' + fni . name ) ;
286
261
}
287
262
288
263
return finalStep && finalStep ( arg ) ;
@@ -433,7 +408,7 @@ lib.addStyleRule = function(selector, styleString) {
433
408
else if ( styleSheet . addRule ) {
434
409
styleSheet . addRule ( selector , styleString , 0 ) ;
435
410
}
436
- else console . warn ( 'addStyleRule failed' ) ;
411
+ else lib . warn ( 'addStyleRule failed' ) ;
437
412
} ;
438
413
439
414
lib . getTranslate = function ( element ) {
0 commit comments