If we have to round trip through JSON and back to a hash, this probably means that we should be exposing a new method. What about extracting the formatting logic to a different function, like so:

```ruby
def format(msg)
  data = msg.to_hash
  data['@timestamp'] = data.delete('time').iso8601(3)
  data
end

def handle(msg)
  data = format(msg)
  data.to_json
end
```

This means that we could test the message content by invoking `#format` and test the printing logic by invoking `#handle`.