author | Michael Krelin <hacker@klever.net> | 2013-11-27 17:11:49 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2013-11-27 17:11:49 (UTC) |
commit | 6cd9e34b5b49473923190a6a70c436908c98505e (patch) (unidiff) | |
tree | d6182625f7406f8b8facb71166c5e4a607dd2c65 | |
parent | 0f1cc2ac41835ee8fa5dded1593fa95092b54bbe (diff) | |
download | clipperz-6cd9e34b5b49473923190a6a70c436908c98505e.zip clipperz-6cd9e34b5b49473923190a6a70c436908c98505e.tar.gz clipperz-6cd9e34b5b49473923190a6a70c436908c98505e.tar.bz2 |
more tracelogging
-rw-r--r-- | backend/node/src/clipperz.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/backend/node/src/clipperz.js b/backend/node/src/clipperz.js index b8b4d3e..04b054a 100644 --- a/backend/node/src/clipperz.js +++ b/backend/node/src/clipperz.js | |||
@@ -63,32 +63,33 @@ var CLIPPERZ = module.exports = function(CONFIG) { | |||
63 | PG.PG.connect(PG.url,function(e,C,D) { | 63 | PG.PG.connect(PG.url,function(e,C,D) { |
64 | if(e) return cb(e); | 64 | if(e) return cb(e); |
65 | var t0=new Date(); | 65 | var t0=new Date(); |
66 | C.query(q,a,function(e,r) { | 66 | C.query(q,a,function(e,r) { |
67 | var t1=new Date(), dt=t1-t0; | 67 | var t1=new Date(), dt=t1-t0; |
68 | D(); | 68 | D(); |
69 | LOGGER.trace({query:q,args:a,ms:dt,rows:r&&r.rowCount,err:e},"SQL query '%s' took %dms",q,dt); | 69 | LOGGER.trace({query:q,args:a,ms:dt,rows:r&&r.rowCount,err:e},"SQL query '%s' took %dms",q,dt); |
70 | cb(e,r); | 70 | cb(e,r); |
71 | }); | 71 | }); |
72 | }); | 72 | }); |
73 | }, | 73 | }, |
74 | T: function(cb) { | 74 | T: function(cb) { |
75 | PG.PG.connect(PG.url,function(e,C,D) { | 75 | PG.PG.connect(PG.url,function(e,C,D) { |
76 | if(e) return cb(e); | 76 | if(e) return cb(e); |
77 | C.query('BEGIN',function(e){ | 77 | C.query('BEGIN',function(e){ |
78 | if(e) return D(),cb(e); | 78 | if(e) return D(),cb(e); |
79 | LOGGER.trace('SQL: transaction begun'); | ||
79 | cb(null,{ | 80 | cb(null,{ |
80 | Q: function(q,a,cb) { | 81 | Q: function(q,a,cb) { |
81 | LOGGER.trace({query:q,args:a},'SQL: %s',q); | 82 | LOGGER.trace({query:q,args:a},'SQL: %s',q); |
82 | if(this.over) return cb(new Error('game over')); | 83 | if(this.over) return cb(new Error('game over')); |
83 | if('function'===typeof a) cb=a,a=[]; | 84 | if('function'===typeof a) cb=a,a=[]; |
84 | var t0=new Date(); | 85 | var t0=new Date(); |
85 | C.query(q,a,function(e,r) { | 86 | C.query(q,a,function(e,r) { |
86 | var t1=new Date(), dt=t1-t0; | 87 | var t1=new Date(), dt=t1-t0; |
87 | LOGGER.trace({query:q,args:a,ms:dt,rows:r&&r.rowCount,err:e},"SQL query '%s' took %dms",q,dt); | 88 | LOGGER.trace({query:q,args:a,ms:dt,rows:r&&r.rowCount,err:e},"SQL query '%s' took %dms",q,dt); |
88 | cb(e,r); | 89 | cb(e,r); |
89 | }); | 90 | }); |
90 | }, | 91 | }, |
91 | commit: function(cb) { | 92 | commit: function(cb) { |
92 | LOGGER.trace('SQL: commit'); | 93 | LOGGER.trace('SQL: commit'); |
93 | if(this.over) return cb(new Error('game over')); | 94 | if(this.over) return cb(new Error('game over')); |
94 | return (this.over=true),C.query('COMMIT',function(e){D();cb&&cb(e)}); | 95 | return (this.over=true),C.query('COMMIT',function(e){D();cb&&cb(e)}); |