The reason is because what is being emitted is an indexed dynamic variable, not static. Solidity stores a keccak256-hash when indexing a dynamic variable, so the string you are getting, 0xb6e... is the keccack256-hash of the string "Hello, world!". More information can be seen here in the Solidity docs.
There are two ways you can handle this:
1) Remove ...
If I understand correctly your want to upload a file from the client machine to the web application using the standard HTML tag <input type="file"> and then hash the
content of the file.
Your code is actually hashing the full path of the file.
If you want to read the content of a file, I recommend to use FileReader like this:
Since all of the eventinloop events will be emitted in a single transaction, you will see the list of all events in the single calc() transaction.
There is no way to react to the first event in the loop, before the second loop is executed (as transactions are atomic, so all events are emitted in a single transaction).
None of the above.
revert() will ensure no event is emitted. This, because revert "reverts" state changes and events are, indeed, state changes. Ergo, any events are reverted so you won't get the diagnostic outputs you are looking for.
Use revert() with reason, revert("<reason>"); or require() with reason, require(<exp>, "<reason>");.
Ethereum event values are always stored using HEX encoding, therefore you need to know the type of the source value in order to decode it correctly.
Web3 provides some functionalities to facilitate the work, for instance, you could have done:
You can easily achieve this using ProvenDB. Here is an example code written in Go to continuously prove your logs' existence and ownership on Blockchain: https://github.com/SouthbankSoftware/provenlogs. Hope it helps :P