openfaas / connector-sdk

SDK for connecting events to functions
MIT License
54 stars 25 forks source link

Add an option to control log verbosity. #27

Closed bmcustodio closed 4 years ago

bmcustodio commented 5 years ago

Connectors built using the SDK are IMHO a bit too verbose:

(...)
2019/08/08 14:16:02 Syncing topic map
2019/08/08 14:16:03 Syncing topic map
2019/08/08 14:16:04 Syncing topic map
2019/08/08 14:16:05 Syncing topic map
2019/08/08 14:16:05 Invoke function: figlet
2019/08/08 14:16:06 Syncing topic map
2019/08/08 14:16:07 Syncing topic map
2019/08/08 14:16:07 Invoke function: figlet
(...)

Besides looking like logging statements that are only useful during development (both of applications and of the SDK itself), I can see this quickly becoming a problem in busy environments. Hence I am adding an option to allow developers to decrease the verbosity.

As a side note, a better approach would of course be to use a logging library such as logrus, but I see that https://github.com/openfaas/faas/issues/572 still didn't yield a conclusion on which to use.

alexellis commented 5 years ago

Hi @bmcstdio

Perhaps the answer is not to turn off the log messages, but to think about whether there is another way to track this i.e. Prometheus metrics exposed about the synchronisation.

How do you want to track the synchronization, or to know whether it was successful? Could you make some suggestions?

Alex