def add_event(c, type, payload):
 SQL = '\n        INSERT INTO events (type, payload)\n        VALUES (%s, %s)\n    '
 c.run(SQL, (type, psycopg2.extras.Json(payload)))

def add_event ( c , type , payload ) : SQL = '\n        INSERT INTO events (type, payload)\n        VALUES (%s, %s)\n    ' c . run ( SQL , ( type , psycopg2 . extras . Json ( payload ) ) )
log an event .