Exa-Networks / exabgp

The BGP swiss army knife of networking
Other
2.05k stars 440 forks source link

healthcheck: fix toconsole condition logging #1200

Closed clwluvw closed 3 months ago

clwluvw commented 4 months ago

Log to console either hasattr() or isatty()

vincentbernat commented 4 months ago

This doesn't look correct. The check requires the isatty attribute to exist to call it. If I remember correctly, it may not exist on Windows, hence the check. With your change, if the attribute does not exist, you call it, which will trigger an exception. And if it exists, you don't really check this is a tty.

clwluvw commented 4 months ago

@vincentbernat This is now not working inside a docker container. Do you have any alternative way to solve it?

vincentbernat commented 4 months ago

Well, I suppose nowaday, when running daemonized, stderr is set to /dev/null, so it shouldn't be a problem to write to it even when this is a not tty, so we may just replace toconsole by not silent. People can still opt out that with --silent.

clwluvw commented 4 months ago

Yeah, that was my first approach as well - but thought maybe better to keep it both. I changed it.

vincentbernat commented 4 months ago

Just do if not silent: instead.

clwluvw commented 4 months ago

Done. PTAL.