-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
Greetings! The below snippet sets up a syslog log handler, either using a unix socket or via UDP to localhost. This happens implicitly by pyeapi being in the import chain which can easily happen if you use Napalm. IMHO, a library should not make decisions about how to handle logs, that should be left up to the application consuming the library. In my case, this became a problem in a CI pipeline when the below code opened a socket. As a safeguard, we have a mechanism in place that throws an exception if a socket is opened by the code under test.
https://github.com/arista-eosplus/pyeapi/blob/develop/pyeapi/utils.py#L47-L50
# Create a handler to log messages to syslog
if sys.platform == "darwin":
_syslog_handler = logging.handlers.SysLogHandler(address='/var/run/syslog')
else:
_syslog_handler = logging.handlers.SysLogHandler()
Metadata
Metadata
Assignees
Labels
No labels