updated log function