pytweezer.loggers.base module¶
Generic Logger base class for InfluxDB metric loggers.
A Logger is a small background worker whose only job is to read some data
source and push values into InfluxDB. Concrete loggers subclass this and override
setup() (open connections) and read() (return the current values);
the base run() loop handles the polling cadence, writing, and teardown.
For a source that pushes data rather than being polled (e.g. a ZMQ subscription),
override run() directly instead of read().
Loggers are launched exactly like devices — see
pytweezer/servers/logger_server.py and the CONFIG["Loggers"] config
category. Nothing reaches InfluxDB unless a Logger (or an explicit
InfluxWriter call) puts it there.
- class pytweezer.loggers.base.Logger(name, conf)[source]¶
Bases:
objectBase class for background InfluxDB loggers.
Subclasses typically override
setup()andread(). Config values live in the logger’sCONFIG["Loggers"][name]entry, available asself.conf.self.writeris a ready-to-useInfluxWriter.- read()[source]¶
Return an iterable of
(measurement, fields, tags)tuples, orNone.Called every
intervalseconds byrun(). Override this in a polling logger.tagsmay beNone.