Sat 18 Mar 2023

A Comprehensive Guide to Structured Logging in Go

Structured logging involves producing log records in a well-defined format (usually JSON), which adds a level of organization and consistency to application logs, making them easier to process. Such log records are composed of key-value pairs that capture relevant contextual information about the event being logged, such as the severity level, timestamp, source code location, user ID, or any other relevant metadata.

This article will delve deep into the world of structured logging in Go, with a specific focus on recently accepted slog proposal which aims to bring high performance structured logging with levels to the standard library.

Source: A Comprehensive Guide to Structured Logging in Go.

The power of single-method interfaces in Go

The other day I was pondering on the prevalence of single-method interfaces (SMI) in Go, and what makes them so effective and useful. SMIs have proven to be a very successful software modeling tool for Go programmers, and you find them all over Go code-bases.

I tried to think about the fundamentals, which brought me to some of the earliest roots of our trade: functional programming and higher-order functions (HOF). I discussed some examples of applying higher-order functions in Go recently.

This post will describe how SMIs are a more general and powerful technique than HOFs. It makes the following claims:

  1. SMIs can do whatever HOFs can
  2. SMIs are more general
  3. SMIs are somewhat more verbose for simple cases

Source: The power of single-method interfaces in Go, an article by Eli Bendersky.

Oblivion (2013)

A veteran assigned to extract Earth's remaining resources begins to question what he knows about his mission and himself.

In the evening Alice, Esme, and I watched Oblivion. I had seen the movie before, years ago. I liked the movie and give it a 7 out of 10.