Index

lognestmonster / 6f43035

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
5728 Dec 2018 00:0542e63e1Update test.jsJoshua161N

Blob @ lognestmonster / tests / test.js

application/javascript1426 bytesdownload raw
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
6const Logger = require("../index.js"); // Should be `lognestmonster` depending on how/where this is run from
7
8Logger.Overseer = new Logger.Logger({
9 name: "MyLogger",
10 locations: {
11 "node": "logs/test"
12 }
13});
14
15let NodeQueue = Logger.Overseer.queue("node");
16NodeQueue.push(Logger.INFO, "PROCESS", "Process started");
17NodeQueue.push(Logger.INFO, "INIT", "Note that Statements can be directly written to the queue as Events can.");
18
19let LoadEvent = new Logger.Event();
20LoadEvent.push(Logger.INFO, "INIT", "We are now one level deep.");
21LoadEvent.push(Logger.DEBUG, "NEW_TAG", "Keep note that you can still change verbosity level and tag/invoker with statements.");
22
23let LowerNestedEvent = new Logger.Event();
24LoadEvent.push(LowerNestedEvent);
25
26LowerNestedEvent.push(Logger.INFO, "INIT", "I am a statement in LowerNestedEvent.");
27LowerNestedEvent.push(Logger.DEBUG, "INIT", "We are now 2 layers deep.");
28
29LoadEvent.push(Logger.DEBUG, "YEET", "Back to 1 layer deep.");
30LoadEvent.push(Logger.INFO, "INIT", "Finished.");
31
32NodeQueue.push(LoadEvent);
33
34NodeQueue.push(Logger.INFO, "INIT", "LoadEvent has now been pushed to the queue. Time to write the queue.");
35
36NodeQueue.write();
37