You can use:
$RT::Logger->warning("The debugging message I want logged");
If your code realises there’s an error (rather than just a debugging warning) you should use:
$RT::Logger->error("Something has gone horrifically wrong");
You could also use normal Perl warn and die functions, though these will appear in the web server logs rather than the RT debugging log.