How to implement the --verbose or -v option into a script?

后端 未结 9 1126
渐次进展
渐次进展 2020-12-12 10:35

I know the --verbose or -v from several tools and I\'d like to implement this into some of my own scripts and tools.

I thought of placing:<

9条回答
  •  囚心锁ツ
    2020-12-12 10:57

    What I do in my scripts is check at runtime if the 'verbose' option is set, and then set my logging level to debug. If it's not set, I set it to info. This way you don't have 'if verbose' checks all over your code.

提交回复
热议问题