Improve event logging implementation in block chain listener by sharing the common code.