This repository was archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdoc_test.go
More file actions
53 lines (47 loc) · 1.25 KB
/
doc_test.go
File metadata and controls
53 lines (47 loc) · 1.25 KB
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
51
52
53
package lunk
import "os"
func Example() {
l := NewJSONEventLogger(os.Stdout)
rootID := NewRootEventID()
l.Log(rootID, Message("root action"))
subID := NewEventID(rootID)
l.Log(subID, Message("sub action"))
leafID := NewEventID(subID)
l.Log(leafID, Message("leaf action"))
// Produces something like this:
// {
// "properties": {
// "msg": "root action"
// },
// "pid": 44345,
// "host": "server1.example.com",
// "time": "2014-04-28T13:58:32.201883418-07:00",
// "id": "09c84ee90e7d9b74",
// "root": "ca2e3c0fdfcf3f5e",
// "schema": "message"
// }
// {
// "properties": {
// "msg": "sub action"
// },
// "pid": 44345,
// "host": "server1.example.com",
// "time": "2014-04-28T13:58:32.202241745-07:00",
// "parent": "09c84ee90e7d9b74",
// "id": "794f8bde67a7f1a7",
// "root": "ca2e3c0fdfcf3f5e",
// "schema": "message"
// }
// {
// "properties": {
// "msg": "leaf action"
// },
// "pid": 44345,
// "host": "server1.example.com",
// "time": "2014-04-28T13:58:32.202257354-07:00",
// "parent": "794f8bde67a7f1a7",
// "id": "33cff19e8bfb7cef",
// "root": "ca2e3c0fdfcf3f5e",
// "schema": "message"
// }
}