Change all logging functions to use template arguments. Add documentation.