Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jessieqliu committed Oct 23, 2024
1 parent 764b445 commit 8bf2b86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions launcher/container_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,17 +579,17 @@ func (r *ContainerRunner) Run(ctx context.Context) error {
return fmt.Errorf("unknown logging redirect location: %v", r.launchSpec.LogRedirect)
}

setupDuration := time.Since(start)
r.logger.Info("Workload setup completed",
"setup_sec", setupDuration.Seconds(),
)

task, err := r.container.NewTask(ctx, cio.NewCreator(streamOpt))
if err != nil {
return &RetryableError{err}
}
defer task.Delete(ctx)

setupDuration := time.Since(start)
r.logger.Info("Workload setup completed",
"setup_sec", setupDuration.Seconds(),
)

exitStatusC, err := task.Wait(ctx)
if err != nil {
r.logger.Error(err.Error())
Expand Down
6 changes: 4 additions & 2 deletions launcher/internal/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ func (l *logger) writeLog(severity clogging.Severity, msg string, args ...any) {
logEntry.Payload = pl

l.cloudLogger.Log(logEntry)
l.cloudLogger.Flush()
if err := l.cloudLogger.Flush(); err != nil {
l.serialLogger.Error(fmt.Sprintf("cloud.Logger.Flush returned error: %v", err))
}

// Write to serial console.
switch severity {
case clogging.Info, clogging.Notice:
case clogging.Info, clogging.Notice, clogging.Debug:
l.serialLogger.Info(msg, args...)
case clogging.Warning:
l.serialLogger.Warn(msg, args...)
Expand Down

0 comments on commit 8bf2b86

Please sign in to comment.