Synchronous logger

Logger with synchronous I/O.

class mpacklog.sync_logger.SyncLogger(path)

Logger with synchronous I/O.

This logger exposes an API similar to AsyncLogger, but all I/O operations are synchronous.

put(message, write=False)

Puts a message in the queue.

Parameters:
  • message (dict) – message to log

  • write (bool) – whether to append the message to the file immediately

write()

Write all messages in the queue to the file.

This method appends to the file if it already exists.