Add logic for logging