How to implement a standard logger and argparser for a package

I am trying to implement a python build package and functional testing package for our internal software development processes. My primary goal is to implement a global/standard logger (similar to the reference [here][1]) and argparser that all modules will use from within their perspective packages (i.e. the build logger and parser will differ from the test suite logger and parser). Should this be done in `` of the package? Are there any other methods to achieve this? I have yet to see what the real need for `` is? Perhaps, this answered my own question? I have written numerous python modules and other apps, but never packages/libraries. This concept seems to introduce new possibilities for me, such as standardizing these processes. Basically, to summarize, my goals for these packages are: 1.) Eliminate the need for redundant passing/parsing of long lists of arguments and/or accessing the system environment. 2.) Eliminate the myriad of outputs that we've seen in the past from varying tests and build scripts. 3.) Provide a self-documenting package that will be easy to use. Any advice on package documentation would be extremely useful, as well. :) This will enable users of these packages to: 1.) Easily access a standard set of arguments. For example, every module in the package will (in order of precedence) parse command-line arguments with standard flags, load a config file, or use default values. 2.) Easily log errors, warnings, and debug statements in a standard way. 3.) As these test/build modules are passed around, this will ultimately enable "users" (i.e. someone who did not write the module) to run it in a universal way. I suppose I am looking for some real "Pythonic" implementation advice because the variety of options and possibilities out there seem to be overwhelming. Thanks in advance. [1]:

以上就是How to implement a standard logger and argparser for a package的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » HBuilder

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准