Source code for bspump.common.print

import sys
import pprint
from ..abc.sink import Sink
from ..abc.processor import Processor


[docs] class PrintSink(Sink): """ Description: | """
[docs] def __init__(self, app, pipeline, id=None, config=None, stream=None): """ Description: | """ super().__init__(app, pipeline, id, config) self.Stream = stream if stream is not None else sys.stdout
[docs] def process(self, context, event): """ Description: | """ print(event, file=self.Stream)
[docs] class PPrintSink(Sink): """ Description: | """
[docs] def __init__(self, app, pipeline, id=None, config=None, stream=None): """ Description: | """ super().__init__(app, pipeline, id, config) self.Stream = stream if stream is not None else sys.stdout
[docs] def process(self, context, event): """ Description: | """ pprint.pprint(event, stream=self.Stream)
[docs] class PrintProcessor(Processor): """ Description: | """
[docs] def __init__(self, app, pipeline, id=None, config=None, stream=None): """ Description: | """ super().__init__(app, pipeline, id, config) self.Stream = stream if stream is not None else sys.stdout
[docs] def process(self, context, event): """ Description: | :return: event """ print(event, file=self.Stream) return event
[docs] class PPrintProcessor(Processor): """ Description: | """
[docs] def __init__(self, app, pipeline, id=None, config=None, stream=None): """ Description: | """ super().__init__(app, pipeline, id, config) self.Stream = stream if stream is not None else sys.stdout
[docs] def process(self, context, event): """ Description: | :return: event """ pprint.pprint(event, stream=self.Stream) return event
[docs] class PrintContextProcessor(Processor): """ Description: | """
[docs] def __init__(self, app, pipeline, id=None, config=None, stream=None): """ Description: | """ super().__init__(app, pipeline, id, config) self.Stream = stream if stream is not None else sys.stdout
[docs] def process(self, context, event): """ Description: | :return: event """ print(context, file=self.Stream) return event
[docs] class PPrintContextProcessor(Processor): """ Description: | """
[docs] def __init__(self, app, pipeline, id=None, config=None, stream=None): """ Description: | """ super().__init__(app, pipeline, id, config) self.Stream = stream if stream is not None else sys.stdout
[docs] def process(self, context, event): """ Description: | :return: event """ pprint.pprint(context, stream=self.Stream) return event