Slightly modified log function