Support log method for programmatic logging

An attempt at #8