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

Side by Side Diff: logdog/client/cmd/logdog_butler/output_logdog.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits Created 3 years, 5 months 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
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 package main 5 package main
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "time" 9 "time"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // TODO(dnj): Default to false when mandatory debugging is finished. 42 // TODO(dnj): Default to false when mandatory debugging is finished.
43 flags.BoolVar(&f.track, "track", true, 43 flags.BoolVar(&f.track, "track", true,
44 "Track each sent message and dump at the end. This adds CPU/memo ry overhead.") 44 "Track each sent message and dump at the end. This adds CPU/memo ry overhead.")
45 45
46 return opt 46 return opt
47 } 47 }
48 48
49 func (f *logdogOutputFactory) configOutput(a *application) (output.Output, error ) { 49 func (f *logdogOutputFactory) configOutput(a *application) (output.Output, error ) {
50 auth, err := a.authenticator(a) 50 auth, err := a.authenticator(a)
51 if err != nil { 51 if err != nil {
52 » » return nil, errors.Annotate(err).Reason("failed to instantiate a uthenticator").Err() 52 » » return nil, errors.Annotate(err, "failed to instantiate authenti cator").Err()
53 } 53 }
54 54
55 host := a.coordinatorHost 55 host := a.coordinatorHost
56 if host == "" { 56 if host == "" {
57 return nil, errors.New("logdog output requires a Coordinator hos t (-coordinator-host)") 57 return nil, errors.New("logdog output requires a Coordinator hos t (-coordinator-host)")
58 } 58 }
59 if f.service != "" { 59 if f.service != "" {
60 host = fmt.Sprintf("%s-dot-%s", f.service, host) 60 host = fmt.Sprintf("%s-dot-%s", f.service, host)
61 } 61 }
62 62
63 cfg := out.Config{ 63 cfg := out.Config{
64 Auth: auth, 64 Auth: auth,
65 Host: host, 65 Host: host,
66 Project: a.project, 66 Project: a.project,
67 Prefix: a.prefix, 67 Prefix: a.prefix,
68 PrefixExpiration: time.Duration(f.prefixExpiration), 68 PrefixExpiration: time.Duration(f.prefixExpiration),
69 SourceInfo: []string{ 69 SourceInfo: []string{
70 "LogDog Butler", 70 "LogDog Butler",
71 }, 71 },
72 PublishContext: a.ncCtx, 72 PublishContext: a.ncCtx,
73 RPCTimeout: 30 * time.Second, 73 RPCTimeout: 30 * time.Second,
74 Track: f.track, 74 Track: f.track,
75 } 75 }
76 return cfg.Register(a) 76 return cfg.Register(a)
77 } 77 }
78 78
79 func (f *logdogOutputFactory) scopes() []string { return out.Scopes() } 79 func (f *logdogOutputFactory) scopes() []string { return out.Scopes() }
OLDNEW
« no previous file with comments | « logdog/client/cmd/logdog_butler/main.go ('k') | logdog/client/cmd/logdog_butler/streamserver.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698