Mercurial > getan
changeset 483:d47e32e6b7e7
Logging can be activated and deactivated.
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Thu, 28 Jun 2018 12:01:16 +0200 |
parents | 999a438474f2 |
children | 40dd1e33c1dd |
files | CHANGES TODO doc/old_issues.txt getan/config.py getan/main.py |
diffstat | 5 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES Wed Jun 27 11:54:56 2018 +0200 +++ b/CHANGES Thu Jun 28 12:01:16 2018 +0200 @@ -1,10 +1,13 @@ 2.x 20xx-xx-xx UNRELEASED + * The logging can now be switched on and off. The default value is off. + If logging is off, no log file is created. + More information can be found in ./doc/old_issues.txt -20170504 BER + * Add a redraw function on key Control-L. The screen is completely redrawn. More information can be found in ./doc/old_issues.txt -20180321 BER - * Better fix for the multiple selection bug. The multiple selection is deleted when deleting or moving is confirmed or when switching to projects.
--- a/TODO Wed Jun 27 11:54:56 2018 +0200 +++ b/TODO Thu Jun 28 12:01:16 2018 +0200 @@ -23,9 +23,6 @@ 20170709 BER: Give scripts/getan-eval.py a more specific name and add it as a script to be installed. -20170504 BER: Some multi-user installations do not want a logfile by default. - We could solve this requirement by making it configurable. - 20160912 BER: Better code: states.py: classes EditEntryState and AdjustEntryState have same methods exit() and set_focus(), maybe join them?
--- a/doc/old_issues.txt Wed Jun 27 11:54:56 2018 +0200 +++ b/doc/old_issues.txt Thu Jun 28 12:01:16 2018 +0200 @@ -1,3 +1,6 @@ +20170504 BER: Some multi-user installations do not want a logfile by default. + We could solve this requirement by making it configurable. + 20180321 BER Add a redraw function/key, usually Control-L is used. If the screen gets disorted, e.g. by a background process spilling some stuff on stderror, you want a completely redrawn screen without
--- a/getan/config.py Wed Jun 27 11:54:56 2018 +0200 +++ b/getan/config.py Thu Jun 28 12:01:16 2018 +0200 @@ -25,10 +25,14 @@ def setup_logging(level, filename): global logger - logging.basicConfig(level=level, - format='%(asctime)s %(levelname)s %(message)s', - filename=filename, - filemode='w') + if level is logging.NOTSET: + logging.NullHandler() + else: + logging.basicConfig(level=level, + format='%(asctime)s %(levelname)s %(message)s', + filename=filename, + filemode='w') + logger = logging.getLogger()
--- a/getan/main.py Wed Jun 27 11:54:56 2018 +0200 +++ b/getan/main.py Thu Jun 28 12:01:16 2018 +0200 @@ -53,8 +53,8 @@ parser.add_argument('--init-only', action='store_true', dest='initonly', help='create databasefile if necessary and exit') parser.add_argument('-d', '--debug', action='store_const', dest='loglevel', - default=logging.INFO, const=logging.DEBUG, - help='set verbosity to debug') + default=logging.NOTSET, const=logging.DEBUG, + help='Enable debung mode') parser.add_argument('-l', '--logfile', dest='logfile', metavar='FILE', help='''write log information to FILE [default: %(default)s]''', default='getan.log')