implement logging logic