Why we wrote Herodotus

We’ve written Herodotus1 as a lightweight logger to solve some very specific problems we had in our tests, but we don’t think they are unique to us so we’re going to share with you what we have done and why. Logging to the standard output and the main problem we faced The problem we are trying to solve is one of readability. All good logs are human readable, as when something has gone wrong to the point of a human needing to look in the logs and piece together what has happened we don’t want to make that more difficult than is needed. Now, there are things out there that will help you manage your logs (for example, OpenSearch provides a fantastic toolkit for exploring a large volume of logs), these are often looking at things on a grander scale than we are. There are always going to be times where you want your system to just leave a little message wherever it is currently running, which is why we are looking at things that are logging to the standard output on whatever device they are running. Specifically in our case, we are looking at the output of an automated test pack. ...

May 17, 2023 · 11 min · 2156 words · George Bell

Testing Standard-Out in Ruby

Testing what a Ruby process writes to STDOUT. Ruby’s relationship with STDOUT Ruby has two built-in values that represent the system’s standard output stream: The constant STDOUT The global variable $stdout The Ruby documentation, describes STDOUT as the standard output, and $stdout and the current standard output. If you want to change the stream that this Ruby process sends its output to, you can change the value of $stdout Hello StringIO Given an RSpec test pack, I should be able to use an output matcher, but I couldn’t get this to reliably work across tests for my system. However, the standard library includes an IO-like object for strings, StringIO, which must be explicitly required. ...

May 15, 2023 · 1 min · 142 words · Nigel Brookes-Thomas