Logging of method calls for recreation

Some games have the option to let you play offline and sync with a server once you have internet again. To prevent cheating and validate if it was an authentic play, usually some sort of log of all input actions is sent and validated afterwards on the server.

In my case I would be interested in a single MonoBehaviour and having all its method calls logged with the its parameters values. Giving this input, the game result output should be the same. (There is no random involved and no physics interaction)

  • One way would be just a writer at the start of each method that logs the timestamp, method name and paramter
  • Another would be maybe something like a multi delegate inbetween that calls both my method and a writer class
  • There is something else (some audit interface, annotation, etc)

What is the best way to achieve the logging? (No the actual format, just how to setup the framework to do the logging)