BlfWriter¶
- class BlfWriter(file, compression_level=Compression.NONE, buffer_size=131072)[source]¶
Bases:
AbstractContextManager[BlfWriter]Binary Log Format (BLF) file writer.
Writes Vector BLF log files with optional compression. Handles automatic buffering and container creation for optimal file structure.
- Parameters:
compression_level (Compression) – Compression level (0-9), defaults to no compression
buffer_size (int) – Size of internal buffer in bytes before flushing, defaults to 128 KiB
- Raises:
TypeError – If file parameter is of unsupported type
- write(obj)[source]¶
Write an object to the BLF file.
The object is first buffered and only written to disk when the buffer is full or when the file is closed.
- Parameters:
obj (ObjectWithHeader[HeaderWithBase]) – Object to write
- Raises:
ValueError – If object size doesn’t match its header
- Return type:
None