forked from BYU-IT515R-Javascript-W15/wd_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.js
More file actions
60 lines (47 loc) · 1.48 KB
/
log.js
File metadata and controls
60 lines (47 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var _ = require('underscore');
function SelMochaLogger ( _config ) {
var config = _.defaults( _config || {} , { sel: { file: 1 }, ws: { file:1 } });
this.config = config;
}
SelMochaLogger.prototype.ws = function ( msg, meta ) {
this.logTest( msg );
if ( this.config.ws.cons ) console.log( msg );
};
SelMochaLogger.prototype.ws_req = function ( msg, meta ) {
this.logTest( msg );
if ( this.config.ws.cons ) console.log( msg );
};
SelMochaLogger.prototype.ws_res = function ( msg, meta ) {
this.logTest( msg );
if ( this.config.ws.cons ) console.log( msg );
};
SelMochaLogger.prototype.sel = function ( msg, meta ) {
if ( this.config.sel.cons ) console.log.apply( console, arguments );
};
SelMochaLogger.prototype.sel_status = function ( msg, meta ) {
this.logTest.apply( this, arguments );
return this.sel.apply(this, arguments);
};
SelMochaLogger.prototype.sel_command= function ( msg, meta ) {
this.logTest.apply( this, arguments );
return this.sel.apply(this, arguments);
};
SelMochaLogger.prototype.sel_http = function ( msg, meta ) {
this.logTest.apply( this, arguments );
return this.sel.apply(this, arguments);
}
;
SelMochaLogger.prototype.startTest = function () {
this.testbuf = "";
};
SelMochaLogger.prototype.logTest = function () {
var self = this;
_.each( arguments, function (x) {
self.testbuf += x + " ";
});
this.testbuf += "\n";
};
SelMochaLogger.prototype.dumpLast = function () {
console.log(this.testbuf);
};
module.exports = SelMochaLogger;