vapor-ware / synse-sdk

SDK for Synse Plugins in Go
https://synse.readthedocs.io/en/latest/sdk/intro/
GNU General Public License v3.0
3 stars 4 forks source link

add line numbers to logging output #168

Closed edaniszewski closed 6 years ago

edaniszewski commented 6 years ago

For me, the logging output is a bit of a headache, partially because of #164 but also because the log output is difficult to do something with unless you have intimate knowledge of where things are in the SDK. For example, if you see logs like:

...
DEBU[0000] ParseDeviceConfig start                      
DEBU[0000] Searching /etc/synse/plugin/config/device for device configurations. 
ERRO[0000] Device configuration path /etc/synse/plugin/config/device does not exist: stat /etc/synse/plugin/config/device: no such file or directory 
ERRO[0000] error when parsing device configs: stat /etc/synse/plugin/config/device: no such file or directory 
ERRO[0000] Failed to register devices from files: stat /etc/synse/plugin/config/device: no such file or directory 
INFO[0000] Plugin Info: 
...

maybe you want to know where these errors are being logged out in the code.. we don't have the file/line info to do that right now.

looking at the logrus docs/issues, it doesn't seem like this is supported right now (though there is a long discussion about it in a still-open issue from 2014...)

Go's built-in log package does support this, so maybe it makes sense to just use that. I think we could also create some middleware/hooks for logrus to give us this info.. but do we really want to?

edaniszewski commented 6 years ago

won't do this. did a bit of research into this before and we'd effectively have to roll our own logger/logging hook. other have done similar things that i've tried, but it doesn't actually help much and some performance measures (from others, not from me) showed sizable decrease in performance.

with #164, and improvements in v1.0 with context, we should hopefully obviate the need for this anyways