Tracing a signal in ModelSim

To log a specific signal in a ModelSim simulation, makeĀ  a script like this:

view list
add list -hex /tb_name/dut/signalname
configure list -usestrobe 1
configure list -strobestart {<time> ns} -strobeperiod {<period> ns}
configure list -usesignaltrigger 0
configure list -delta none
configure list -usegating 1
configure list -gateexpr { /tb_name/dut/rst_n=='1' }
write list -window .list <output_filename.log>