It's 2020. Is there any way to get syslog to work on macOS Mojave? Questions on syslog on macOS get no answers these days, the reason apparently being that 'it just doesn't work'.
Still, I would like to try one more time.
Is there a way that a syslog opened with
openlog ('apns', 'ndelay', 'mail');

to work on macOS Mojave?
No, the old way of logging is gone. The API to write to the new unified log are published.

https://eclecticlight.co/2018/03/19/macos-unified-log-1-why-what-and-how/
https://developer.apple.com/documentation/os/logging

There are quite a few WWDC sessions covering this as well as hundreds of blog posts with specifics. Depending on what specifically you are trying to do, the unified log can be a quick patch and sometimes be much better than when each log went to a different file.
To address your specific code, you would create an object instead of calling openlog function.

https://developer.apple.com/documentation/os/logging/generating_log_messages_from_your_code

Then it’s pretty equivalent to inject your values into the system logging stream. From the command line shell, you can still call logger and nothing has changed. How you compile or interpret your code will govern which API you call, but it’s totally allowed to log still in 2020 on macOS.