boilerplate icon indicating copy to clipboard operation
boilerplate copied to clipboard

switch logging to slog

Open jlambert121 opened this issue 6 months ago • 3 comments

Description

Fixes #82.

Currently all logging is done via utils.Logger which just outputs logging to stdout. It would be nice to have more control over logging by silencing logging when not needed or injecting a separate logger (compatible with *slog.Logger).

There is a lot of lines of change here, but it's just creating a slog.Handler that prefixes [boilerplate] to log lines to maintain the existing look and passing an instance of the logger throughout. go is not my primary language though, any feedback is greatly appreciated!

NOTE: This does bump the minimum go version to 1.21.

TODOs

Read the Gruntwork contribution guidelines.

  • [ ] Update the docs.
  • [ ] Run the relevant tests successfully, including pre-commit checks.
  • [ ] Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • [ ] Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Updated logging to use slog library.

Migration Guide

None

jlambert121 avatar Aug 11 '24 16:08 jlambert121