javascript logger function