Typical UNIX programs send the valid output you expect to stdout, and any error messages to stderr, so that if you want to capture the output, you won’t capture the error messages. I think this might be because it is difficult to separate them after the fact.
If you have the output combined, you’d have to look for those error messages and remove them from the file list based on a pattern. But what if there’s a file called dir: permission denied?
In a shell (bash, for example) script, it’s really easy to do:
if find "$dir" -type f > "${tmpdir}/files.out" 2> "${tmpdir}/error.out"; then
if [ -s "${tmpdir}/error.out" ]; then
echo "find exited with success but there were some individual errors"
else
echo "find exited with success and there were no error messages"
fi
fi
(untested code off the top of my head)
It’s just so much easier for me to do: /path/to/foo --options >/dev/null to see only the error messages, rather than trying to make an inclusive or exclusive pattern for a grep.
I know that’s not going to be “easy” to many other people, but “old Unix sysadmins” like me just think that way.
Yeah, totally.
But I would argue that per UNIX philosophy programs usually do not print anything if they’re successful. If a program has some inherent output, Log is probably not the right tool for that.
So my argument is that Log output always go to stderr (or somewhere else), never to stdout.
This shard do good job for it purpose, and especially suitable for UNIX command line program, the only concerns is, is it appropriate to name it as Log ?
The word “opinionated” is often misused, especially in open-source projects.
All projects already reflect the decisions of their creators and using “opinionated” is tautology.
Additionally, authors often use “opinionated” to deflect criticism, which now carries a negative connotation.
These observations come from my experiences with various open-source projects and sometimes within private companies too.
Well, I found a minor bug in the crystal tooling because logging and just outputting don’t mix well.
And I don’t think it feels right to use two different methods to make output.
I see your point, but it can be a bit mucky what’s output and what’s logging.
In most of the CLI frameworks I’ve crossed (in PHP land, which might not be the best example), they like to hand over a class to take care of output with appropriate methods for info, errors perhaps table output. And then completely ignore the difference between stderr and stdout, sadly…