| 43 | |
| 44 | return new (class { |
| 45 | constructor(name, opts) { |
| 46 | this.logLevels = { debug: 0, info: 1, warn: 2, error: 3 } |
| 47 | this.logLevelPrefixs = { |
| 48 | debug: '[DEBUG] ', |
| 49 | info: '[INFO] ', |
| 50 | warn: '[WARN] ', |
| 51 | error: '[ERROR] ' |
| 52 | } |
| 53 | this.logLevel = 'info' |
| 54 | this.name = name |
| 55 | this.http = new Http(this) |
| 56 | this.data = null |
| 57 | this.dataFile = 'box.dat' |
| 58 | this.logs = [] |
| 59 | this.isMute = false |
| 60 | this.isNeedRewrite = false |
| 61 | this.logSeparator = '\n' |
| 62 | this.encoding = 'utf-8' |
| 63 | this.startTime = new Date().getTime() |
| 64 | Object.assign(this, opts) |
| 65 | this.log('', `🔔${this.name}, 开始!`) |
| 66 | } |
| 67 | |
| 68 | getEnv() { |
| 69 | if ('undefined' !== typeof Egern) return 'Egern' |