How to write verbose scripts

BJörn Lindqvist bjourne at gmail.com
Wed Sep 3 08:50:57 EDT 2008


2008/9/3 Hendrik van Rooyen <mail at microcorp.co.za>:
>
> Steven D'Aprano <stev...bersource.com.au> wrote:
>
>>Is there a better way of doing this than the way I am going about it?
>
> Not sure if its "better", but I would keep the messages in a table or dict and
> have different tables or dicts for different levels of verbosity, and write a
> displayer that knows about the verbosity - This approach has the advantage that
> you can write in English and have different verbosities in different languages
> too, if the displayer knows about the language.

One big downside with that approach is that it becomes much harder to
grep for the log message. Usually when I go through logs, I don't care
what exactly the message says, just that it is easily googleable (uses
some kind of identifying text) and that it is unique so I can know
exactly where it was emitted.


-- 
mvh Björn



More information about the Python-list mailing list