Guys
For what its worth:-
Most of my code logs to a level using something like
command .... --verbose 10 ..... || -v10 etc.
In my code, I call a trace routine that simply checks the verbose level
with the call level and log if it is -ge.
EG:-
// in simple terms.
tr ( level, msg ) {
if ( level -ge g_level ) {
print_whatever ( $msg )
}
}
....
tr 12 "MSG:some relevant message"
.....
tr 2 "ERROR:some error message"
..
etc
All level 0 are printed regardless, IE g_level defaults to 0.
The print_whatever is a complex function that automatically opens a log
file etc
and prints ERROR to stderr and all others to stdout.
I am sure there must be thousands of variations on this theme.
My contribution as a long time wget user. Thanks Guys.
Regards
Ian