UNPKG

349 BJavaScriptView Raw
1const Logger = require('./logger')
2
3class Log4j {
4 constructor (desc) {
5 this.desc = desc
6 this.start = Date.now()
7 }
8
9 end () {
10 this.end = Date.now()
11 }
12
13 print () {
14 Logger.consume(`${this.desc} -> ${this.end - this.start} ms`)
15 }
16
17 static push (log4j) {
18 Log4j.log.push(log4j)
19 }
20}
21
22Log4j.log = []
23
24module.exports = Log4j