logging function working now