rpkimancer.utils module

Utilities and helper classes and functions.

class rpkimancer.utils.LogWriter(logger, level=20, level_cb=None)

Bases: TextIOBase

File-like object for stream-to-log redirection.

Parameters:
  • logger (logging.Logger) –

  • level (int) –

  • level_cb (Optional[LogLevelCallback]) –

detach()

Detatch the underlying binary buffer.

Return type:

BinaryIO

read(size=-1)

Read from the text stream.

Parameters:

size (Optional[int]) –

Return type:

str

write(s)

Write the contents of a buffer to the stream.

Parameters:

s (str) –

Return type:

int

redirect_stdout()

Return a context manager to redirect stdout.

Return type:

ContextManager[Any]