@@ -136,8 +136,8 @@ func (c *Container) runHealthCheck(ctx context.Context, isStartup bool) (define.
136
136
}
137
137
138
138
eventLog := output .String ()
139
- if c .config . HealthMaxLogSize != 0 && len (eventLog ) > int (c .config . HealthMaxLogSize ) {
140
- eventLog = eventLog [:c .config . HealthMaxLogSize ]
139
+ if c .HealthCheckMaxLogSize () != 0 && len (eventLog ) > int (c .HealthCheckMaxLogSize () ) {
140
+ eventLog = eventLog [:c .HealthCheckMaxLogSize () ]
141
141
}
142
142
143
143
if timeEnd .Sub (timeStart ) > c .HealthCheckConfig ().Timeout {
@@ -150,7 +150,7 @@ func (c *Container) runHealthCheck(ctx context.Context, isStartup bool) (define.
150
150
151
151
healthCheckResult , err := c .updateHealthCheckLog (hcl , inStartPeriod , isStartup )
152
152
if err != nil {
153
- return hcResult , "" , fmt .Errorf ("unable to update health check log %s for %s: %w" , c .config . HealthLogDestination , c .ID (), err )
153
+ return hcResult , "" , fmt .Errorf ("unable to update health check log %s for %s: %w" , c .getHealthCheckLogDestination () , c .ID (), err )
154
154
}
155
155
156
156
// Write HC event with appropriate status as the last thing before we
@@ -404,7 +404,7 @@ func (c *Container) updateHealthCheckLog(hcl define.HealthCheckLog, inStartPerio
404
404
}
405
405
}
406
406
healthCheck .Log = append (healthCheck .Log , hcl )
407
- if c .config . HealthMaxLogCount != 0 && len (healthCheck .Log ) > int (c .config . HealthMaxLogCount ) {
407
+ if c .HealthCheckMaxLogCount () != 0 && len (healthCheck .Log ) > int (c .HealthCheckMaxLogCount () ) {
408
408
healthCheck .Log = healthCheck .Log [1 :]
409
409
}
410
410
return healthCheck , c .writeHealthCheckLog (healthCheck )
@@ -420,11 +420,11 @@ func (c *Container) witeToFileHealthCheckResults(path string, result define.Heal
420
420
421
421
func (c * Container ) getHealthCheckLogDestination () string {
422
422
var destination string
423
- switch c .config . HealthLogDestination {
423
+ switch c .HealthCheckLogDestination () {
424
424
case define .DefaultHealthCheckLocalDestination , define .HealthCheckEventsLoggerDestination , "" :
425
425
destination = filepath .Join (filepath .Dir (c .state .RunDir ), "healthcheck.log" )
426
426
default :
427
- destination = filepath .Join (c .config . HealthLogDestination , c .ID ()+ "-healthcheck.log" )
427
+ destination = filepath .Join (c .HealthCheckLogDestination () , c .ID ()+ "-healthcheck.log" )
428
428
}
429
429
return destination
430
430
}
0 commit comments