rename 'handleLog' to 'write to be inline with twisted.

This commit is contained in:
Michel Oosterhof 2015-04-12 05:22:31 +00:00
parent 82a1f12937
commit 80e2e92169
2 changed files with 6 additions and 11 deletions

View File

@ -49,7 +49,7 @@ import uuid
class Output(object):
"""
This is the abstract base class intended to be inherited by kippo output plugins
Plugins require the mandatory methods: stop, start and handleLog
Plugins require the mandatory methods: stop, start and write
"""
__metaclass__ = abc.ABCMeta
@ -91,7 +91,7 @@ class Output(object):
pass
@abc.abstractmethod
def handleLog(self, session, event):
def write(self, event):
"""Handle a general event within the output plugin"""
pass
@ -147,7 +147,9 @@ class Output(object):
self.ips[sessionno] = ev['src_ip']
del ev['system']
self.handleLog(self.sessions[sessionno], ev)
ev['session'] = self.sessions[sessionno]
self.write(ev)
# disconnect is special, remove cached data
if ev['eventid'] == 'KIPP0011':

View File

@ -39,16 +39,9 @@ class Output(kippo.core.output.Output):
def stop(self):
pass
def write(self, session, logentry):
_meta = {
'session' : session,
}
logentry.update( _meta )
def write(self, logentry):
json.dump( logentry, self.outfile )
self.outfile.write( '\n' )
self.outfile.flush()
def handleLog( self, session, event ):
self.write( session, event )
# vim: set sw=4 et: