Browse code

Changing logging statments to Clayton's spec

Fixing utilglog printing. Infof arguments shown as missing when using verbose logger.

jupierce authored on 2016/06/20 04:25:49
Showing 6 changed files
... ...
@@ -63,7 +63,7 @@ func newBuilderConfigFromEnvironment(out io.Writer) (*builderConfig, error) {
63 63
 	masterVersion := os.Getenv(api.OriginVersion)
64 64
 	thisVersion := version.Get().String()
65 65
 	if len(masterVersion) != 0 && masterVersion != thisVersion {
66
-		fmt.Fprintf(cfg.out, "warning: OpenShift server version %q differs from this image %q\n", masterVersion, thisVersion)
66
+		glog.V(3).Infof("warning: OpenShift server version %q differs from this image %q\n", masterVersion, thisVersion)
67 67
 	} else {
68 68
 		glog.V(4).Infof("Master version %q, Builder version %q", masterVersion, thisVersion)
69 69
 	}
... ...
@@ -138,7 +138,7 @@ func execPostCommitHook(client DockerClient, postCommitSpec api.BuildPostCommitS
138 138
 		// Post commit hook is not set, return early.
139 139
 		return nil
140 140
 	}
141
-	glog.V(0).Infof("Running post commit hook with image %s ...", image)
141
+	glog.V(0).Infof("Running post commit hook ...")
142 142
 	glog.V(4).Infof("Post commit hook spec: %+v", postCommitSpec)
143 143
 
144 144
 	if script != "" {
... ...
@@ -116,7 +116,7 @@ func (d *DockerBuilder) Build() error {
116 116
 		if authPresent {
117 117
 			glog.V(4).Infof("Authenticating Docker push with user %q", pushAuthConfig.Username)
118 118
 		}
119
-		glog.V(0).Infof("Pushing image %s ...", pushTag)
119
+		glog.V(0).Infof("\nPushing image %s ...", pushTag)
120 120
 		if err := pushImage(d.dockerClient, pushTag, pushAuthConfig); err != nil {
121 121
 			return fmt.Errorf("Failed to push image: %v", err)
122 122
 		}
... ...
@@ -210,7 +210,7 @@ func extractGitSource(gitClient GitClient, gitSource *api.GitBuildSource, revisi
210 210
 	usingRef := len(gitSource.Ref) != 0 || (revision != nil && revision.Git != nil && len(revision.Git.Commit) != 0)
211 211
 
212 212
 	// Recursive clone if we're not going to checkout a ref and submodule update later
213
-	glog.V(0).Infof("Cloning source from %s", gitSource.URI)
213
+	glog.V(3).Infof("Cloning source from %s", gitSource.URI)
214 214
 
215 215
 	// Only use the quiet flag if Verbosity is not 5 or greater
216 216
 	quiet := !glog.Is(5)
... ...
@@ -200,7 +200,7 @@ func (s *S2IBuilder) Build() error {
200 200
 	config.PreviousImagePullPolicy = s2iapi.PullAlways
201 201
 
202 202
 	allowedUIDs := os.Getenv(api.AllowedUIDs)
203
-	glog.V(0).Infof("The value of %s is [%s]", api.AllowedUIDs, allowedUIDs)
203
+	glog.V(4).Infof("The value of %s is [%s]", api.AllowedUIDs, allowedUIDs)
204 204
 	if len(allowedUIDs) > 0 {
205 205
 		err := config.AllowedUIDs.Set(allowedUIDs)
206 206
 		if err != nil {
... ...
@@ -208,7 +208,7 @@ func (s *S2IBuilder) Build() error {
208 208
 		}
209 209
 	}
210 210
 	dropCaps := os.Getenv(api.DropCapabilities)
211
-	glog.V(0).Infof("The value of %s is [%s]", api.DropCapabilities, dropCaps)
211
+	glog.V(4).Infof("The value of %s is [%s]", api.DropCapabilities, dropCaps)
212 212
 	if len(dropCaps) > 0 {
213 213
 		config.DropCapabilities = strings.Split(dropCaps, ",")
214 214
 	}
... ...
@@ -227,7 +227,7 @@ func (s *S2IBuilder) Build() error {
227 227
 	config.PullAuthentication, _ = dockercfg.NewHelper().GetDockerAuth(config.BuilderImage, dockercfg.PullAuthType)
228 228
 	config.IncrementalAuthentication, _ = dockercfg.NewHelper().GetDockerAuth(pushTag, dockercfg.PushAuthType)
229 229
 
230
-	glog.V(0).Infof("Creating a new S2I builder with build config: %#v\n", describe.DescribeConfig(config))
230
+	glog.V(4).Infof("Creating a new S2I builder with build config: %#v\n", describe.DescribeConfig(config))
231 231
 	builder, err := s.builder.Builder(config, s2ibuild.Overrides{Downloader: download})
232 232
 	if err != nil {
233 233
 		return err
... ...
@@ -261,11 +261,11 @@ func (s *S2IBuilder) Build() error {
261 261
 			dockercfg.PushAuthType,
262 262
 		)
263 263
 		if authPresent {
264
-			glog.V(0).Infof("Using provided push secret for pushing %s image", pushTag)
264
+			glog.V(3).Infof("Using provided push secret for pushing %s image", pushTag)
265 265
 		} else {
266
-			glog.V(0).Infof("No push secret provided")
266
+			glog.V(3).Infof("No push secret provided")
267 267
 		}
268
-		glog.V(0).Infof("Pushing image %s ...", pushTag)
268
+		glog.V(0).Infof("\nPushing image %s ...", pushTag)
269 269
 		if err := pushImage(s.dockerClient, pushTag, pushAuthConfig); err != nil {
270 270
 			// write extended error message to assist in problem resolution
271 271
 			msg := fmt.Sprintf("Failed to push image. Response from registry is: %v", err)
... ...
@@ -47,7 +47,7 @@ func (glogger) V(level int) Logger {
47 47
 }
48 48
 
49 49
 func (glogger) Infof(format string, args ...interface{}) {
50
-	glog.Infof(format, args)
50
+	glog.Infof(format, args...)
51 51
 }
52 52
 
53 53
 // gverbose handles glog.V(x) calls
... ...
@@ -67,7 +67,7 @@ func (gverbose) V(level int) Logger {
67 67
 }
68 68
 
69 69
 func (g gverbose) Infof(format string, args ...interface{}) {
70
-	g.Verbose.Infof(format, args)
70
+	g.Verbose.Infof(format, args...)
71 71
 }
72 72
 
73 73
 // file logs the provided messages at level or below to the writer, or delegates