Events are used to track the execution of a transaction sent to a contract. There are convenient interfaces with the EVM logging facilities. Here is an example, as follows:
pragma solidity ^0.4.24;
contract Purchase {
event buyEvent(address bidder, uint amount); // Event
function buy() public payable {
emit buyEvent(msg.sender, msg.value); // Triggering event
}
}