1 | // This test file is written to test for forward-compatibility as |
2 | // I update the package, having been written at the stage of |
3 | // earliest functionality and stability. The hope is that as |
4 | // new things are added to the package, old things won't break. |
5 |
|
6 | const Logger = require("../index.js"); // Should be `lognestmonster` depending on how/where this is run from |
7 |
|
8 | Logger.Overseer = new Logger.Logger({ |
9 | name: "MyLogger", |
10 | locations: { |
11 | "node": "logs/test" |
12 | } |
13 | }); |
14 |
|
15 | let NodeQueue = Logger.Overseer.queue("node"); |
16 | NodeQueue.push(Logger.INFO, "PROCESS", "Process started"); |
17 | NodeQueue.push(Logger.INFO, "INIT", "Note that Statements can be directly written to the queue as Events can."); |
18 |
|
19 | let LoadEvent = new Logger.Event(); |
20 | LoadEvent.push(Logger.INFO, "INIT", "We are now one level deep."); |
21 | LoadEvent.push(Logger.DEBUG, "NEW_TAG", "Keep note that you can still change verbosity level and tag/invoker with statements."); |
22 |
|
23 | let LowerNestedEvent = new Logger.Event(); |
24 | LoadEvent.push(LowerNestedEvent); |
25 |
|
26 | LowerNestedEvent.push(Logger.INFO, "INIT", "I am a statement in LowerNestedEvent."); |
27 | LowerNestedEvent.push(Logger.DEBUG, "INIT", "We are now 2 layers deep."); |
28 |
|
29 | LoadEvent.push(Logger.DEBUG, "YEET", "Back to 1 layer deep."); |
30 | LoadEvent.push(Logger.INFO, "INIT", "Finished."); |
31 |
|
32 | NodeQueue.push(LoadEvent); |
33 |
|
34 | NodeQueue.push(Logger.INFO, "INIT", "LoadEvent has now been pushed to the queue. Time to write the queue."); |
35 |
|
36 | NodeQueue.write(); |
37 |
|