mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
allows possibility to set the driver used in syslog for unix sockets
This changes allows a use to set the driver used to send the data over a unix socket. 'dgram' for a dgram driver or 'stream' for a stream driver. 'stream' is the default. The change is documented in the settings documentation. fix #671
This commit is contained in:
parent
a3e7b68119
commit
24bfae8508
@ -1062,7 +1062,15 @@ class SyslogTo(Setting):
|
|||||||
default = "udp://localhost:514"
|
default = "udp://localhost:514"
|
||||||
|
|
||||||
desc = """\
|
desc = """\
|
||||||
Address to send syslog messages
|
Address to send syslog messages.
|
||||||
|
|
||||||
|
Adress are a string of the form:
|
||||||
|
- 'unix://PATH#TYPE' : for unix domain socket. TYPE can be 'stream'
|
||||||
|
for the stream driver or 'dgram' for the dgram driver. 'stream' is
|
||||||
|
the default.
|
||||||
|
- 'udp://HOST:PORT' : for UDP sockets
|
||||||
|
- 'tcp://HOST:PORT' : for TCP sockets
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,16 @@ class SafeAtoms(dict):
|
|||||||
def parse_syslog_address(addr):
|
def parse_syslog_address(addr):
|
||||||
|
|
||||||
if addr.startswith("unix://"):
|
if addr.startswith("unix://"):
|
||||||
return (socket.SOCK_STREAM, addr.split("unix://")[1])
|
sock_type = socket.SOCK_STREAM
|
||||||
|
|
||||||
|
# are we using a different socket type?
|
||||||
|
parts = addr.split("#", 1)
|
||||||
|
if len(parts) == 2:
|
||||||
|
addr = parts[0]
|
||||||
|
if part[1] == "dgram":
|
||||||
|
sock_type = socket.SOCK_DGRAM
|
||||||
|
|
||||||
|
return (sock_type, addr.split("unix://")[1])
|
||||||
|
|
||||||
if addr.startswith("udp://"):
|
if addr.startswith("udp://"):
|
||||||
addr = addr.split("udp://")[1]
|
addr = addr.split("udp://")[1]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user