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

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

Issue 2517503002: luci-go: Basic support for event logging in Go. (Closed)
Patch Set: Created 4 years, 1 month 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
« common/eventlog/settings.go ('K') | « common/eventlog/settings.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
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
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.
7 package main
8
9 import (
10 "fmt"
11 "time"
12
13 "golang.org/x/net/context"
14
15 "github.com/luci/luci-go/common/eventlog"
16 logpb "github.com/luci/luci-go/common/eventlog/proto"
17 )
18
19 func main() {
20 c := eventlog.NewClient("http://localhost:27910/log")
21 ctx := context.Background()
22
23 event := c.NewLogEvent(ctx, eventlog.TypedTime{time.Now(), logpb.ChromeI nfraEvent_POINT})
24
25 // Log a build event. Other kinds of events may also be logged.
26 event.InfraEvent.BuildEvent = &logpb.BuildEvent{ /* TODO:fill in content s */ }
27
28 err := c.LogSync(ctx, []*eventlog.ChromeInfraLogEvent{event})
29 if err != nil {
30 fmt.Printf("logging: %v\n", err)
31 }
32 }
OLDNEW
« common/eventlog/settings.go ('K') | « common/eventlog/settings.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698