I'm looking for a solution where we can log in hours and minutes when 12v is detected. I want to log the usage of the machine in hours and minutes.
You may want to consider using a voltage divider or regulator and polling a connected GPIO pin.
I assume when it drops out - it’s gone (0V).
… or are you looking for the schematic and sketch?
What do you want to do that is different from this: https://www.ebay.com/itm/HONEYWELL-HOBBS-169635-ELECTROMECHANICAL-12-60-VDC-BOAT-HOUR-METER-/192325910622 ?
Are you logging to SD card or a PC or do you just want to display the time the machine has been running. Do you need a resettable counter or must the time log be permanent?