Skip to content

Commit

Permalink
examples/go/clock: format logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lithdew committed Jun 17, 2020
1 parent c416938 commit 1e698db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions examples/go/clock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A demo of peer discovery and bidirectional streaming, and Flatend by itself with

Run `go run main.go` on one terminal. Run `go run main.go clock` on several other terminals.

Watch nodes randomly querying and respond to each others requests for their current time.
Watch nodes randomly querying and responding to each others requests for their current time.

```
[terminal 1] $ go run main.go
Expand All @@ -14,9 +14,9 @@ Got someone's time ('Jun 18 00:06:57')! Sent back ours ('Jun 18 00:06:57').
2020/06/18 00:06:57 [::]:45309 has connected. Services: [clock]
Got someone's time ('Jun 18 00:06:57')! Sent back ours ('Jun 18 00:06:57').
[1] Asked someone for their current time. Ours is 'Jun 18 00:06:57'.
[1] Got a response! Their current time is: Jun 18 00:06:57
[1] Got a response! Their current time is: 'Jun 18 00:06:57'.
[2] Asked someone for their current time. Ours is 'Jun 18 00:06:57'.
[2] Got a response! Their current time is: Jun 18 00:06:57
[2] Got a response! Their current time is: 'Jun 18 00:06:57'.
[3] Asked someone for their current time. Ours is 'Jun 18 00:06:58'.
[terminal 2] $ go run main.go clock
Expand All @@ -25,17 +25,17 @@ Got someone's time ('Jun 18 00:06:57')! Sent back ours ('Jun 18 00:06:57').
2020/06/18 00:06:57 Re-probed 127.0.0.1:9000. Services: [clock]
2020/06/18 00:06:57 Discovered 0 peer(s).
[0] Asked someone for their current time. Ours is 'Jun 18 00:06:57'.
[0] Got a response! Their current time is: Jun 18 00:06:57
[0] Got a response! Their current time is: 'Jun 18 00:06:57'.
2020/06/18 00:06:57 [::]:45309 has connected. Services: [clock]
Got someone's time ('Jun 18 00:06:57')! Sent back ours ('Jun 18 00:06:57').
[1] Asked someone for their current time. Ours is 'Jun 18 00:06:58'.
[1] Got a response! Their current time is: Jun 18 00:06:58
[1] Got a response! Their current time is: 'Jun 18 00:06:58'.
[2] Asked someone for their current time. Ours is 'Jun 18 00:06:58'.
[2] Got a response! Their current time is: Jun 18 00:06:58
[2] Got a response! Their current time is: 'Jun 18 00:06:58'.
Got someone's time ('Jun 18 00:06:58')! Sent back ours ('Jun 18 00:06:58').
Got someone's time ('Jun 18 00:06:58')! Sent back ours ('Jun 18 00:06:58').
[3] Asked someone for their current time. Ours is 'Jun 18 00:06:58'.
[3] Got a response! Their current time is: Jun 18 00:06:58
[3] Got a response! Their current time is: 'Jun 18 00:06:58'.
[terminal 3] $ go run main.go clock
2020/06/18 00:06:57 Listening for Flatend nodes on '[::]:45309'.go clock
Expand All @@ -44,14 +44,14 @@ Got someone's time ('Jun 18 00:06:58')! Sent back ours ('Jun 18 00:06:58').
2020/06/18 00:06:57 You are now connected to [::]:44369. Services: [clock]
2020/06/18 00:06:57 Discovered 1 peer(s).
[0] Asked someone for their current time. Ours is 'Jun 18 00:06:57'.
[0] Got a response! Their current time is: Jun 18 00:06:57
[0] Got a response! Their current time is: 'Jun 18 00:06:57'.
Got someone's time ('Jun 18 00:06:57')! Sent back ours ('Jun 18 00:06:57').
Got someone's time ('Jun 18 00:06:58')! Sent back ours ('Jun 18 00:06:58').
Got someone's time ('Jun 18 00:06:58')! Sent back ours ('Jun 18 00:06:58').
[1] Asked someone for their current time. Ours is 'Jun 18 00:06:58'.
[1] Got a response! Their current time is: Jun 18 00:06:58
[1] Got a response! Their current time is: 'Jun 18 00:06:58'.
[2] Asked someone for their current time. Ours is 'Jun 18 00:06:58'.
[2] Got a response! Their current time is: Jun 18 00:06:58
[2] Got a response! Their current time is: 'Jun 18 00:06:58'.
Got someone's time ('Jun 18 00:06:58')! Sent back ours ('Jun 18 00:06:58').
```

Expand Down Expand Up @@ -140,7 +140,7 @@ func main() {
check(err)
}

fmt.Printf("[%d] Got a response! Their current time is: %s\n", i, string(res))
fmt.Printf("[%d] Got a response! Their current time is: '%s'\n", i, string(res))
}
}
}()
Expand Down
2 changes: 1 addition & 1 deletion examples/go/clock/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func main() {
check(err)
}

fmt.Printf("[%d] Got a response! Their current time is: %s\n", i, string(res))
fmt.Printf("[%d] Got a response! Their current time is: '%s'\n", i, string(res))
}
}
}()
Expand Down

0 comments on commit 1e698db

Please sign in to comment.