Four ways to extend the go 1.21 slog Logger

In my previous blog post on the Anchorage Digital blog, I wrote about logging features I’d love to see built around the new slog package coming in Go 1.21. I heard from several people that they want to learn more about how exactly to do this. To answer these questions, I built out 6 examples of how to extend slog, showing 4 different strategies. I used some of the use-cases from the last blog post. The example code and detailed explanations can be found here. Feel free to copy-paste and modify any of these examples. ...

August 6, 2023

Getting the most out of the Go 1.21 slog package

Go 1.21 will be released with many improvements that I appreciate, but the one that stands out to me the most is the addition of the log/slog package. It serves as a great foundation for a logging system, but there’s a lot more to logging than what it offers out of the box. I published a blog post on the Anchorage Digital Blog that points out some logging features that can and should be added around this package. I hope others find this useful! Reach out on Twitter if you want tips on implementing any of what I wrote about. ...

July 25, 2023

Practical Policy Enforcement with CUE

I have been using CUE for over 2 years and I’ve found it to be incredibly good at defining policies. CUE is an elegant configuration language because of the guarantees that it can express. It has many additional uses such as applying policies on existing configurations, whether they are written in CUE or in another format like JSON or YAML. Let’s take a look at some easy and practical policy enforcement applications for CUE for Kubernetes, OpenAPI and Terraform. ...

June 6, 2023