Is Rfc5424SysLogHandler.build_msg meant to be thought of as a public method, or is it an implementation detail?
We've got an http endpoint that accepts rfc5424-encoded messages. I've got everything working with something like this:
class HttpRfcHandler(Rfc5424SysLogHandler):
"""Extend Rfc5424SysLogHandler to support http:// addresses"""
def emit(self, record):
try:
msg = self.build_msg(record)
response = requests.post(url=self.address, data=msg)
response.raise_for_status()
except Exception:
self.handleError(record)
(not encluding some stuff that's specific to our environment).
Am I okay treating build_msg like it's part of the public API in this way?
Also, since the urlparse logic for checking the scheme of self.address is pretty simple, would built-in support for this use-case be worth adding in a PR? I don't know how common it is.
An alternative would be to add a section to the docs talking about this subclassing approach, which I guess would let people write to whatever sink they want (object storage, message queues, etc.)
Is Rfc5424SysLogHandler.build_msg meant to be thought of as a public method, or is it an implementation detail?
We've got an http endpoint that accepts rfc5424-encoded messages. I've got everything working with something like this:
(not encluding some stuff that's specific to our environment).
Am I okay treating
build_msglike it's part of the public API in this way?Also, since the
urlparselogic for checking the scheme ofself.addressis pretty simple, would built-in support for this use-case be worth adding in a PR? I don't know how common it is.An alternative would be to add a section to the docs talking about this subclassing approach, which I guess would let people write to whatever sink they want (object storage, message queues, etc.)