I'm trying to setup a simple logging framework in my shell scripts. For this I'd like to define a "log" function callable as
log "LEVEL" $message
Where the message is a variable to which I have previously redirected the outputs of executed commands. My trouble is that I get errors with the following
{message=command 2>&3 1>&3 3>&-} >&3
log "INFO" $message
There's something wrong isn't there?
TIA
I've developed a simple multi-level logger for my shell scripts, you can take a look for use, inspiration, or whatever you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With