You should modify your info(), warn(), and error() methods to only throw an error if a certain verbosity level is reached. The logic for detecting verbosity should go inside of those logging methods (as opposed to other parts of the code) because it would be less duplication of code.
Here's recommended integers to determine verbosity.
Int
Purpose
0
Error output (>= 0)
1
Warning output (>= 1)
2
Info output (>= 2)
The logic behind the above output is:
You always want to show errors (so default verbosity to 0)
If the user needs more info they can increase the verbosity to warn (a la -v).
If the user still needs more info they can increase the verbosity further to info (a la -vv).
You should modify your
info()
,warn()
, anderror()
methods to only throw an error if a certain verbosity level is reached. The logic for detecting verbosity should go inside of those logging methods (as opposed to other parts of the code) because it would be less duplication of code.Here's recommended integers to determine verbosity.
The logic behind the above output is:
-v
).-vv
).