Mercurial > personal > weather-server
diff weather_server/locations.py @ 24:20c8ec56e447
logfile: Pull logfile thread out of Logger.
This enables automatic garbage collection of Logger instances,
since a running thread no longer has a reference to a Logger's self.
It separates exclusive management of logfile state into the
_writer_thread function, which now opens the file and writes it until
it is told to stop by receiving the poison pill.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 10 Nov 2019 23:07:11 -0500 |
parents | e229afdd447b |
children | 7def5611895b |
line wrap: on
line diff
--- a/weather_server/locations.py Sun Nov 10 19:42:04 2019 -0500 +++ b/weather_server/locations.py Sun Nov 10 23:07:11 2019 -0500 @@ -31,7 +31,7 @@ 'location', 'name', fallback='Weather station') self.tz_name = parser.get('location', 'timezone', fallback='UTC') self.password = parser.get('location', 'password') - self.logger = logfile.Logger.create( + self.logger = logfile.Logger( str(root / LOG), sample_field='sample_time') except (IOError, KeyError, configparser.Error): raise ConfigError("Couldn't load location info.")