# Path: splunklib/modularinput/event.py
# class Event(object):
#     def __init__(self, data=None, stanza=None, time=None, host=None, index=None, source=None,
#                  sourcetype=None, done=True, unbroken=True):
#     def write_to(self, stream):


import sys
from splunklib.six import ensure_str
from .event import ET
    from splunklib.six.moves import cStringIO as StringIO
    from splunklib.six import StringIO

    def write_event(self, event):
        """Writes an ``Event`` object to Splunk.

        :param event: An ``Event`` object.
        """

        if not self.header_written:
            self._out.write("<stream>")
            self.header_written = True

        event.write_to(self._out)

    def log(self, severity, message):
        """Logs messages about the state of this modular input to Splunk.
        These messages will show up in Splunk's internal logs.

        :param severity: ``string``, severity of message, see severities defined as class constants.
        :param message: ``string``, message to log.
        """

        self._err.write("%s %s\n" % (severity, message))
        self._err.flush()

    def write_xml_document(self, document):
        """Writes a string representation of an
        ``ElementTree`` object to the output stream.

        :param document: An ``ElementTree`` object.
        """

# Path: splunklib/modularinput/event.py
# class Event(object):
#     def __init__(self, data=None, stanza=None, time=None, host=None, index=None, source=None,
#                  sourcetype=None, done=True, unbroken=True):
#     def write_to(self, stream):


# Path: splunklib/modularinput/event_writer.py
import sys
from splunklib.six import ensure_str
from .event import ET
    from splunklib.six.moves import cStringIO as StringIO
    from splunklib.six import StringIO


    def write_event(self, event):
        """Writes an ``Event`` object to Splunk.

        :param event: An ``Event`` object.
        """

        if not self.header_written:
            self._out.write("<stream>")
            self.header_written = True

        event.write_to(self._out)

    def log(self, severity, message):
        """Logs messages about the state of this modular input to Splunk.
        These messages will show up in Splunk's internal logs.

        :param severity: ``string``, severity of message, see severities defined as class constants.
        :param message: ``string``, message to log.
        """

        self._err.write("%s %s\n" % (severity, message))
        self._err.flush()

    def write_xml_document(self, document):
        """Writes a string representation of an
        ``ElementTree`` object to the output stream.

        :param document: An ``ElementTree`` object.
        """

        self._out.write(ensure_str(ET.tostring(document)))