Welcome. If you want to write to EE’s developer log (found in the Control Panel) then you can use the Logger class. https://docs.expressionengine.com/latest/development/legacy/libraries/logger.html#developerdata-update–false-expires–0
ee()->logger->developer('Log message.');
If you want to write to the template debugger then you can use the log_item
method from the Template class. https://docs.expressionengine.com/latest/development/legacy/libraries/template.html#log_itemstr-details–false
ee()->TMPL->log_item("An error has occurred");
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.