MCPcopy Index your code
hub / github.com/cloudnative-pg/cloudnative-pg / LogStatus

Method LogStatus

pkg/postgres/status.go:245–267  ·  view source on GitHub ↗

LogStatus logs the current status of the instances

(ctx context.Context)

Source from the content-addressed store, hash-verified

243
244// LogStatus logs the current status of the instances
245func (list *PostgresqlStatusList) LogStatus(ctx context.Context) {
246 contextLogger := log.FromContext(ctx)
247
248 total := len(list.Items)
249 for idx, item := range list.Items {
250 message := fmt.Sprintf("pod status (%d of %d)", idx+1, total)
251 contextLogger.Info(message,
252 "name", item.Pod.Name,
253 "currentLsn", item.CurrentLsn,
254 "receivedLsn", item.ReceivedLsn,
255 "replayLsn", item.ReplayLsn,
256 "isPrimary", item.IsPrimary,
257 "isPodReady", item.IsPodReady,
258 "pendingRestart", item.PendingRestart,
259 "pendingRestartForDecrease", item.PendingRestartForDecrease,
260 "statusCollectionError", item.Error)
261 }
262
263 contextLogger.Debug(
264 `detailed pod status`,
265 "data", list,
266 )
267}
268
269// Len implements sort.Interface extracting the length of the list
270func (list *PostgresqlStatusList) Len() int {

Calls 2

InfoMethod · 0.80
DebugMethod · 0.80

Tested by

no test coverage detected