How to know if an Arduino restarted as a result of a WDT timeout?


I have a code in arduino in which I have implemented 8 second watchdog, to test them I put a for loop and everything works correctly, I want to know if it is possible to print a message when a watchdog timeout occurs in the arduino, specifically what I want to do is send a message by xbee when a reset has occurred caused by the watch dog, I already have the xbee logic, how do I know when this reset occurs?

I already tried the solution raised here but it doesn't work for me:Link
My Code:

#include <avr/wdt.h>
void setup()
  Serial.println("turning on");

void loop()
 for (int i = 0; i <= 9; i++) {
    }  //Test to activate watchdog

       //My code ....

 wdt_reset();    // reset the watch dog to zero

Use "Interrupt and System Reset" mode:

The third mode, Interrupt and System Reset mode, combines the other two modes by first giving an interrupt and then switch to System Reset mode. This mode will for instance allow a safe shutdown by saving critical parameters before a system reset.

In the WDT interrupt you can do anything you want (until the Watchdog timer expires again). I expect what you want to do might need you to enable interrupts.