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

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

Issue 2456673003: Butler: export Coordinator host in environment. (Closed)
Patch Set: Relieve suspense. 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
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 "bytes" 8 "bytes"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 func (a *application) authenticator(ctx context.Context) (*auth.Authenticator, e rror) { 108 func (a *application) authenticator(ctx context.Context) (*auth.Authenticator, e rror) {
109 opts, err := a.authFlags.Options() 109 opts, err := a.authFlags.Options()
110 if err != nil { 110 if err != nil {
111 return nil, err 111 return nil, err
112 } 112 }
113 return auth.NewAuthenticator(ctx, auth.SilentLogin, opts), nil 113 return auth.NewAuthenticator(ctx, auth.SilentLogin, opts), nil
114 } 114 }
115 115
116 func (a *application) configOutput() (output.Output, error) { 116 // getOutputFactory returns the currently-configured output factory.
117 func (a *application) getOutputFactory() (outputFactory, error) {
117 factory := a.outputConfig.getFactory() 118 factory := a.outputConfig.getFactory()
118 if factory == nil { 119 if factory == nil {
119 return nil, errors.New("main: No output is configured") 120 return nil, errors.New("main: No output is configured")
120 } 121 }
121 122 » return factory, nil
122 » output, err := factory.configOutput(a)
123 » if err != nil {
124 » » return nil, err
125 » }
126
127 » return output, nil
128 } 123 }
129 124
130 // runWithButler is an execution harness that adds application-level management 125 // runWithButler is an execution harness that adds application-level management
131 // to a Butler run. 126 // to a Butler run.
132 func (a *application) runWithButler(ctx context.Context, out output.Output, 127 func (a *application) runWithButler(ctx context.Context, out output.Output,
133 runFunc func(context.Context, *butler.Butler) error) error { 128 runFunc func(context.Context, *butler.Butler) error) error {
134 129
135 // Enable CPU profiling if specified 130 // Enable CPU profiling if specified
136 if a.cpuProfile != "" { 131 if a.cpuProfile != "" {
137 f, err := os.Create(a.cpuProfile) 132 f, err := os.Create(a.cpuProfile)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 334
340 paniccatcher.Do(func() { 335 paniccatcher.Do(func() {
341 rc = mainImpl(ctx, os.Args[1:]) 336 rc = mainImpl(ctx, os.Args[1:])
342 }, func(p *paniccatcher.Panic) { 337 }, func(p *paniccatcher.Panic) {
343 log.Fields{ 338 log.Fields{
344 "panic.error": p.Reason, 339 "panic.error": p.Reason,
345 }.Errorf(ctx, "Panic caught in main:\n%s", p.Stack) 340 }.Errorf(ctx, "Panic caught in main:\n%s", p.Stack)
346 rc = runtimeErrorReturnCode 341 rc = runtimeErrorReturnCode
347 }) 342 })
348 } 343 }
OLDNEW
« no previous file with comments | « logdog/client/butlerlib/bootstrap/environment.go ('k') | logdog/client/cmd/logdog_butler/output_logdog.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698