Use loglevel for debug logging (resolves #8)