1 | const statement = require("./statement.js"); |
2 | const event = require("./event.js") |
3 |
|
4 | class Logger { |
5 | constructor(config) { |
6 | this.nameVar = "Logger"; |
7 | this.locationsVar = { |
8 | "node": "./log/node" |
9 | } |
10 | if (config) { |
11 | if (config.name) { |
12 | if (typeof config.name != "string") throw new Error(`Expected string, got ${typeof config.name} for config.name`); |
13 | this.name = config.name; |
14 | } |
15 | if (config.locations) { |
16 | if (typeof config.locations != "object") throw new Error(`Expected object, got ${typeof config.locations} for config.locations`); |
17 | this.locations = config.locations; |
18 | } |
19 | } |
20 | return this; |
21 | } |
22 |
|
23 | get name() {return this.nameVar} |
24 | get locations() {return this.locationsVar} |
25 |
|
26 | set name(name) {this.nameVar = name} |
27 | set locations(newLocation) {this.addLocation(newLocation)} |
28 |
|
29 | addLocation(name, location) { |
30 | this.locationsVar[name] = location; |
31 | return this; |
32 | } |
33 |
|
34 | push() { |
35 | return this; |
36 | } |
37 |
|
38 | queue() { |
39 | return this; |
40 | } |
41 |
|
42 | write() { |
43 | return this; |
44 | } |
45 | } |
46 |
|
47 | module.exports = Logger; |
48 |
|