You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a convention on how PyKE should deal with printing feedback to the users and writing logfiles. The current system based on verbose and logfile arguments is not in line with the logging mechanisms used by major scientific packages. I propose the following:
Main principles
There shall be no print statements anywhere.
All user feedback messages shall be delivered via a new keplog.log(level, message) function, which in turn shall make use of either Python's or AstroPy's built-in logging framework, which support different levels of logging (ERROR, WARNING, INFO, DEBUG).
Consequences
The verbose arguments shall be removed in favor of the config mechanisms provided by the logging framework. A convenience function called keplog.set_level can be added to help users set the log level (e.g. keplog.set_level(DEBUG)). The command-line tools can have a user-friendly --silent or --debug option to set the log level to ERROR or DEBUG, respectively.
All logfile arguments shall be removed in favor of the config mechanisms offered by the logging framework. A convenience function called e.g. keplog.set_logfile can be added to help users divert output to a logfile.
Other conventions
Whenever PyKE writes a file, it must be reported to the user via keplog.log(INFO, "Writing " + filename).
Progressbars shall have their desc and disable argument set, i.e. tqdm(iterable, desc="Informative description", disable=(keplog.get_level() <= INFO))
Command-line tools should catch all exceptions and print them via keplog.log(ERROR, msg).
What do y'all think?
The text was updated successfully, but these errors were encountered:
We need a convention on how PyKE should deal with printing feedback to the users and writing logfiles. The current system based on
verbose
andlogfile
arguments is not in line with the logging mechanisms used by major scientific packages. I propose the following:Main principles
print
statements anywhere.keplog.log(level, message)
function, which in turn shall make use of either Python's or AstroPy's built-inlogging
framework, which support different levels of logging (ERROR
,WARNING
,INFO
,DEBUG
).Consequences
verbose
arguments shall be removed in favor of the config mechanisms provided by the logging framework. A convenience function calledkeplog.set_level
can be added to help users set the log level (e.g.keplog.set_level(DEBUG)
). The command-line tools can have a user-friendly--silent
or--debug
option to set the log level toERROR
orDEBUG
, respectively.logfile
arguments shall be removed in favor of the config mechanisms offered by the logging framework. A convenience function called e.g.keplog.set_logfile
can be added to help users divert output to a logfile.Other conventions
keplog.log(INFO, "Writing " + filename)
.desc
anddisable
argument set, i.e.tqdm(iterable, desc="Informative description", disable=(keplog.get_level() <= INFO))
keplog.log(ERROR, msg)
.What do y'all think?
The text was updated successfully, but these errors were encountered: