Module cleanup

Localize private functions. Move log event target to the Nginx
log file, with ngx.WARN priority. Add module versioning.