newb question about @property
On Tue, 3 Oct 2017 10:01 pm, Lele Gaifax wrote:
> Steve D'Aprano <steve+python at pearwood.info> writes:
>> (9) [ADVANCED] Modify the decorator from (8) to take an argument specifying
>> the path to a file, and use the logging module to log the details to that
>> file instead of printing them.
> This may suffer of excessive creativity, as usually the details of *where* a
> logger writes the messages are better left to a configuration done at another
> level :)
Right. I didn't say the path has to be hard-coded in the source.
@addlogging(config.logfile or default_logfile)
def function(x, y, z):
In production code, I'd probably pass a logger instance rather than a file name.
But in any case, its only a programming exercise, not meant to be
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.