How to convert the power value of an optical module?

Hello,
As shown in the attached figure, the transmit power unit of the optical module obtained from the switch using the snmp protocol is uW. I want to convert this value unit to dBm in the appearance of the device. How does this code represent?
1.png
2.png
3.png
4.png

Hello,
The conversion formula has been found, how to write the code in Dude’s appearance?
dBm=10*log(uW/1000)