How to write log in libraries?

I want to write log in libraries…
I added the new log struct on LogStructure.h
and added log write code in RangeFinder.h…

but return error when build…
error message is ‘LOG_PACKET_HEADER does not name a type’

How can I fix this error?
what should I do??

If that’s the exact error message you have a typo.

If this is a temporary log message, consider using Log_Write(…) instead:

https://github.com/ardupilot/ardupilot/blob/master/libraries/AP_TECS/AP_TECS.cpp#L1079