Make representClusterNodeFlags() more robust.
Make representClusterNodeFlags() more robust.

This function failed when an internal-only flag was set as an only flag
in a node: the string was trimmed expecting a final comma before
exiting the function, causing a crash. See issue #4142.
Moreover generation of flags representation only needed at DEBUG log
level was always performed: a waste of CPU time. This is fixed as well
by this commit.

pedigree/redis,pedigree/redis,pedigree/redis,pedigree/redis