fixed copy paste error
implemented the possibility to pass a defined log function