An application doesn't get to decide what happens to its log messages if syslog is used. That decision is made by the configuration of the syslog daemon.
There are several ways you can control log destinations on a system with syslog:
Your application can be set to log on a particular facility. There are some system-level facilities such as
daemon, as well as eight facilities reserved for local use:
local7. You can either hard-code one of these in to your application or make it selectable through a configuration option.
Even the most basic syslog daemons can be configured to log different facilities to different files.
Another option is that more modern syslog daemons such as syslog-ng and rsyslog can also be configured to scan the message and log to a different destination based on a tag in the message. It's common for many applications to put a tag such as
[foo] at the start of their syslog message.
Note that filtering based on a message tag will generally have worse performance, eg: lower log throughput than just filtering on the facility. For high volume syslog servers this can become a bottleneck.