How to get previous shutdown cause?
I usually just run

sudo grep "Previous shutdown cause" /var/log/system.log


or (if the above returns empty)

sudo zgrep "Previous shutdown cause" /var/log/system.log.*.gz