-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.js
50 lines (45 loc) · 1.27 KB
/
console.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const DieScheite = require('../index');
const actSystem = DieScheite.start();
const logPublisher = DieScheite.publishers.console.start(actSystem, { pretty: true });
const ds = DieScheite.generic({
serviceId: 'example-console',
serviceVersion: '0.1.0',
serviceInstanceId: '01'
}, logPublisher);
let scope = {
correlationId: "asdf"
};
let res = ds.loggedAction(DieScheite.scope.generic(scope), entry => {
entry.addHeader("Foo", "bar");
entry
.info("Hej");
entry
.error("Aj")
.attach("my_attach", "asdf", "text/plain", "")
.addHeader("ERR", "Aj");
return entry
.trace("A", entry => {
entry
.info("A:1")
.attach("a1_att", "asdf", "text/plain", "");
return entry.trace("B", entry => {
entry
.info("B:1")
.attach("b1_att", "asdf", "text/plain", "");
return entry.trace("C", entry => {
entry
.info("C:1")
.attach("c1_att", "asdf", "text/plain", "");
return 1;
});
})
.then(() => entry.info("A:2"));
})
.then(() => entry.info("Done"))
.then(() => 1);
})
.then(res => {
console.log("FINAL", res)
return res.published.then(() => console.log("PUBLISHED"));
})
.then(() => console.log("========== END ============"));