Using Gadget

Logging Operations

>>> gadget.log_operation('setup', 'db1', {'use_transactions': True})

The code above will log that an operation called setup ran on an entity named db1, and as extra parameters would include {'use_transactions': True}.

Note

entities of operations can be either a single string id, a list of ids, or a dictionary mapping entitiy roles to entity ids:

>>> gadget.log_operation('copy', {'source': '/tmp/file1.txt', 'target': '/tmp/file2.txt'})

Note

entity ids are completely arbitrary, and it is the user’s responsibility to make sure they are indeed unique in the log.

Logging Updates

>>> gadget.log_update('db1', {'connection_string': '...'})

Logging States

>>> gadget.log_state('db1', {'connected': True, 'num_records': 1000})