Fully compatible "log" snippet for JS.