js - updated logging with a dedicated fuction