Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: examples/eventlog/main.go

Issue 2557593002: Add batch logging support to eventlog. (Closed)
Patch Set: Fix race in test. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/eventlog/internal/logservice/logservice.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 // eventlog is an example that demonstrates how to log to the eventlog service. 5 // eventlog is an example that demonstrates how to log to the eventlog service.
6 // It logs to a locally-run server. See go/localeventlog for more information. 6 // It logs to a locally-run server. See go/localeventlog for more information.
7 package main 7 package main
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
11 11
12 "golang.org/x/net/context" 12 "golang.org/x/net/context"
13 13
14 "github.com/luci/luci-go/common/eventlog" 14 "github.com/luci/luci-go/common/eventlog"
15 logpb "github.com/luci/luci-go/common/eventlog/proto" 15 logpb "github.com/luci/luci-go/common/eventlog/proto"
16 ) 16 )
17 17
18 func main() { 18 func main() {
19 c := eventlog.NewClient("http://localhost:27910/log")
20 ctx := context.Background() 19 ctx := context.Background()
20 c := eventlog.NewClient(ctx, "http://localhost:27910/log")
21 21
22 event := c.NewLogEvent(ctx, eventlog.Point()) 22 event := c.NewLogEvent(ctx, eventlog.Point())
23 23
24 // Log a build event. Other kinds of events may also be logged. 24 // Log a build event. Other kinds of events may also be logged.
25 event.InfraEvent.BuildEvent = &logpb.BuildEvent{ /* TODO:fill in content s */ } 25 event.InfraEvent.BuildEvent = &logpb.BuildEvent{ /* TODO:fill in content s */ }
26 26
27 err := c.LogSync(ctx, event) 27 err := c.LogSync(ctx, event)
28 if err != nil { 28 if err != nil {
29 fmt.Printf("logging: %v\n", err) 29 fmt.Printf("logging: %v\n", err)
30 } 30 }
31 } 31 }
OLDNEW
« no previous file with comments | « common/eventlog/internal/logservice/logservice.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698