import "github.com/aws/amazon-ssm-agent/agent/log" func main() { logger := log.NewDefaultLogger() logger.Debugf("Starting foo function...") // ... }
import "github.com/aws/amazon-ssm-agent/agent/log" func main() { logger := log.NewDefaultLogger() err := doSomeOperation() if err != nil { logger.Error("Failed to perform operation", err) } } func doSomeOperation() error { // ... }In this example, we create a new logger instance and call the `Error()` method to log an error message along with the error object returned from the `doSomeOperation()` function. Overall, the `github.com/aws/amazon-ssm-agent/agent/log` package provides a set of logging functions that can be used to log messages of varying severity levels with or without additional contextual information.