Hi @ianmorris1960_2,
You could go about this a completely different way if you want to. You could attach the 5V pin of the Leonardo to an analog pin, and read the input as a voltage. When it drops below, say, 4.5V, then save a value in eeprom, and you could have the Leonardo go to sleep. On wakeup, you read eeprom to see if there was a power loss. Im not sure what your project is so I'm not sure if this would work for you.