Add ability to log security-related events.

(not ready for merge; starting a PR so travis will sanity-check what's there so far...)