Skip to content

Remove Syslog log handler #296

@aedwardstx

Description

@aedwardstx

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions