Using AWS SDK With Go for EC2 AMI Metrics - sheldonhull.com #162
Replies: 4 comments
-
Instead of going horizontal like this: log.Info().Int("result_count", len(respInstances.Reservations)).Dur("duration", time.Since(start)).Msg("\tresults returned for ec2instances") It would read better on separate lines: log.Info().
Int("result_count", len(respInstances.Reservations)).
Dur("duration", time.Since(start)).
Msg("\tresults returned for ec2instances") As long as you end with periods the parser won't choke on it. |
Beta Was this translation helpful? Give feedback.
-
Good feedback. I agree, much easier to read. |
Beta Was this translation helpful? Give feedback.
-
@mrxinu I'm designing so that it would use structured output in the first place. However, is there any more elegant way to handle the nesting of the log messages for output other than embedded tabs Normally I'd just output to text and be done, but I did that to make the debugging a little easier. |
Beta Was this translation helpful? Give feedback.
-
I wouldn't conflate logging with debugging output. I would strip the logging of any formatting, maybe even go with JSON output for easy consumption later, and then have a separate file handle to stdout and/or a log. I'd check out the io.MultiWriter interface and the lumberjack package. https://golang.org/pkg/io/#MultiWriter |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Using AWS SDK With Go for EC2 AMI Metrics - sheldonhull.com
https://www.sheldonhull.com/blog/using-aws-sdk-with-go-for-ec2-ami-metrics/
Beta Was this translation helpful? Give feedback.
All reactions