Go を使って職場の改善のためのコマンドラインツールを多数書いています。 シンプルなツールの場合、まずは標準出力に色々出力していきますが、そのうちログも欲しいと言われるケースが多いです。 そんな時に Go の場合はどうしているか、というと io.MultiWriter を使います。 func MultiWriter(writers ...Writer) Writer MultiWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command. Each write is written to each listed writer, one at a time. If a listed writer returns an erro