this is not possible when the transaction is a contract creation as the returned value is not the transaction receipt but the contract instance.
One of the benefits of Truffle is that it hides away a lot of the complexity from the user, but don't let that fool you; whilst creating a contract is a special transaction (in that it has no to address), it is still a transaction and has a corresponding Transaction ID/Hash. We can verify this by using Etherscan to find a contract creation transaction.
If you want to get hold of this, then you are going to have to get your hands a little dirty and do some of the heavy lifting that Truffle hides away from you: if you look at the web3 documentation then you can find how to deploy a contract.
As per the documentation, you can see that after some work setting up the necessary code, a transaction hash for the transaction of creating a contract can be retrieved.
...
var myContractInstance = MyContract.new(param1, param2, {data: myContractCode, gas: 300000, from: mySenderAddress});
// The hash of the transaction, which created the contract
myContractInstance.transactionHash
I'm not entirely sure how this relates to the title question
how to check if an event was added to the log in a contract contructor
I will add, that the events API allows you to look for events in past blocks - as per the documentation you can specify the block to start looking from:
...
// watch for an event with {some: 'args'}
var myEvent = myContractInstance.MyEvent({some: 'args'}, {fromBlock: 0, toBlock: 'latest'});
You may, therefore, be able to achieve this by
- 1: Finding out the current block number
- 2: Deploying the contract with Truffle and waiting for it to be mined - as you are already doing
- 3: Call the event code specifying a block number in from equal to the block number in step 1.