Choose appropriate log levels and write clear, meaningful log messages that provide necessary context without creating noise. Follow these guidelines:

  1. Use appropriate log levels:
  2. Include relevant context in messages:

Example of good logging:

// Bad
log.Info("Operation failed")
log.Info("Starting operation")

// Good
log.Errorf("Failed to revert denied tables for workflow %v: %v", workflowName, err)
log.Infof("Starting VReplication player id: %v, settings: %+v", id, settings)
  1. Avoid duplicate logging:
  2. Consider log readers: