I am trying to make a working example for logrotate, and to help me through this I figured it was a good idea to turn stderr to red.
Through some reading, I came upon stderred, which I meant to adopt. I downloaded it, make'd it and it works nicely for the user.
The red formatting however is lost when the command is summoned through sudo. Specifically, red formatting is visible with this command:
$ /usr/games/cowsay -f fudge Yo
cowsay: Could not find fudge cowfile!
but not with this command:
$ sudo /usr/games/cowsay -f fudge Yo
cowsay: Could not find fudge cowfile!
I have tried editing /root/.bashrc to contain:
export LD_PRELOAD="/home/user/path/to/stderred/build/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
but that apparently does not make it work. What am I missing?