comect.sidecar.parsers.base module

class comect.sidecar.parsers.base.Parser

Bases: abc.ABC

Parsers are in charge of transforming lines of text into usable objects, where required.

They can simply transform the string and return it, or they can change it into some other object entirely. Like the Filters, you could just use a function if that suits you better.

If you’re subclassing, then you must implement __call__().

abstract __call__(line, path)

Processes a line of text from your logs, transforming it into something useful.

Parameters
  • line (Union[str, bytes]) – The line to be processed

  • path (Path) – The path to the file the line is from

Return type

Any

Returns

The processed data - whatever it is