logging: simplify stringer array building
logging: simplify stringer array building

The need for this patch was suggested by Avi half a year ago, see:
https://groups.google.com/d/msg/scylladb-dev/M8k0BQXSFRk/ycACA4RUEQAJ
and he also came up with the specific technique used in this patch.

Some background: We don't want every unique combination of arguments to
log() to generate tons of different code. So we pack up the arguments (or
actually, "stringers" which know how to print the arguments when needed)
in a C array, which is passed to the function really_do_log(). This function
is not a template, so can only be compiled once, and contains the bulk of the
logging logic.

Before this patch, the array was filled using recursive metaprogramming,
where the leaf call was the one which had to know what to do (call
really_do_log()) - while all the callers hold their stringers alive in the stack.

After this patch, the array is filled using different, non-recursive and
much shorter, trickery based on parameter pack expansion. The flow is now
easier to understand, and modify. do_log() now calls really_do_log(),
without a long chain of recursive function calls separating them.

Signed-off-by: Nadav Har'El <625169824b719df98706d88646d0aae6f368ae4d@scylladb.com>
Message-Id: <1468846602-4802-1-git-send-email-625169824b719df98706d88646d0aae6f368ae4d@scylladb.com>

cloudius-systems/seastar,dreamsxin/seastar,kjniemi/seastar,scylladb/seastar,syuu1228/seastar,scylladb/seastar,cloudius-systems/seastar,kjniemi/seastar,avikivity/seastar,avikivity/seastar,dreamsxin/seastar,kjniemi/seastar,scylladb/seastar,avikivity/seastar,dreamsxin/seastar,syuu1228/seastar,syuu1228/seastar,cloudius-systems/seastar