konnected-io / konnected-security

Konnected connects wired sensors and switches to SmartThings, Home Assistant, Hubitat and OpenHAB
https://konnected.io
Apache License 2.0
416 stars 322 forks source link

Update lfs files to utilize structured logger #137

Closed kit-klein closed 3 years ago

kit-klein commented 3 years ago

This PR migrates the lfs modules to utilize a logger. Log output format shifts from

Heap:   41336   HTTP:   Starting server at http://192.168.1.213:9794
Heap:   41160   Loaded:         server
Heap:   39272   REST Endpoint:  nil
Heap:   39240   Loaded:         application
Heap:   36840   UPnP:   Sent SSDP NOTIFY

to

[INFO  14.593499, 39136]: HTTP:  Starting server at http://192.168.1.213:9794
[INFO  14.609761, 39240]: Loaded:  server
[INFO  14.819109, 37200]: REST Endpoint: nil
[INFO  14.834246, 37904]: Loaded:  application
[INFO  29.765033, 36416]: UPnP: Sent SSDP NOTIFY

Note that all logs now include a level, timestamp, and heap. This differs a bit from the pro board as the debug module, which exposes lines and files, isn't included in the 8266 implementation.

Using the logger seems to impact HEAP reports by about 1300 bytes. It doesn't seem it impact performance in any other notable way.