Browse Source

Add XMLHttpRequest debug log

Ben Hsieh 8 years ago
parent
commit
aacc8d36fd
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      src/polyfill/XMLHttpRequest.js

+ 4
- 4
src/polyfill/XMLHttpRequest.js View File

10
 
10
 
11
 const log = new Log('XMLHttpRequest')
11
 const log = new Log('XMLHttpRequest')
12
 
12
 
13
-// log.disable()
14
-log.level(3)
13
+log.disable()
14
+// log.level(2)
15
 
15
 
16
 const UNSENT = 0
16
 const UNSENT = 0
17
 const OPENED = 1
17
 const OPENED = 1
246
     for(let i in respHeaders) {
246
     for(let i in respHeaders) {
247
       result += `${i}: ${respHeaders[i]}${String.fromCharCode(0x0D,0x0A)}`
247
       result += `${i}: ${respHeaders[i]}${String.fromCharCode(0x0D,0x0A)}`
248
     }
248
     }
249
-    console.log('###', result.substr(0, result.length-2))
250
     return result.substr(0, result.length-2)
249
     return result.substr(0, result.length-2)
251
   }
250
   }
252
 
251
 
315
     }
314
     }
316
     if(resp) {
315
     if(resp) {
317
       let info = resp.respInfo || {}
316
       let info = resp.respInfo || {}
317
+      log.debug(this._url, info, info.respType)
318
       switch(info.respType) {
318
       switch(info.respType) {
319
         case 'json' :
319
         case 'json' :
320
         try{
320
         try{
348
   }
348
   }
349
 
349
 
350
   set onreadystatechange(fn:() => void) {
350
   set onreadystatechange(fn:() => void) {
351
-    log.verbose('XMLHttpRequest set onreadystatechange', fn.toString())
351
+    log.verbose('XMLHttpRequest set onreadystatechange', fn)
352
     this._onreadystatechange = fn
352
     this._onreadystatechange = fn
353
   }
353
   }
354
 
354