Implemented new logging function