Add global -d option to set library debug level