syslog-ng: Refactor configuration generation logic and add more unit tests

The old method was hard to maintain, so this commit introduces a more clean solution.
The commit also contains documentation fixes and new testcases.

Please review it and let me know if there is something more to change :) It would be nice to have this in upstream. I was promised about the merge, you can find here some information about it:

https://github.com/saltstack/salt/issues/14716