Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saved search added and tested #5

Open
wants to merge 10 commits into
base: master
from

modified LogglySyslogHandler so it works

  • Loading branch information
mnuyens committed Jun 7, 2012
commit b51f6517f299decc1dce3f637dc004fbe67da69e
@@ -42,7 +42,7 @@ def emit(self, record):
async_post_to_endpoint(self.endpoint, msg)


class LogglySyslogHandler(SysLogHandler):
class LogglySyslogHandler(logging.handlers.SysLogHandler):
def __init__(self, session=None, port=None, inputname='', input=None,
announce=False, authorize=True, **kwargs):
#TODO: avoid duplication with __init__ above
@@ -66,7 +66,19 @@ def __init__(self, session=None, port=None, inputname='', input=None,
if ('tcp' in input.service['name'] and sys.version_info >= (2, 7)
and not 'socktype' in kwargs):
kwargs['socktype'] = socket.SOCK_STREAM
self.socktype=socket.SOCK_STREAM
else:
self.socktype=socket.SOCK_DGRAM
self.port = port
session = session or LogglySession
SysLogHandler.__init__(self, address=(session.proxy, port),
self.session = session or LogglySession
SysLogHandler.__init__(self, address=(self.session.proxy, self.port),
**kwargs)

def emit(self, record):
if isinstance(record.msg, (list, dict)):
record.msg = dumps(record.msg, cls=self.json_class, default=str)
msg = self.format(record)
sock=socket.socket(socket.AF_INET,self.socktype)
sock.connect((self.session.proxy,self.port))
sock.sendall(msg+'\n')
sock.close()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.