logger: add '\n' after formatting message

Log formatters may truncate the given Log message when there is not an
enough buffer space.  '\n' should be added after the log messages are
formatted.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: add str_len to logmsg structure

This removes redundant strlen() calls.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: add format_thread_name()

This prepares for the next patch.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: simplify formatters

Calling a lot of snprintf() is not clean and makes the codes difficult
to read.  This reduces the number of snprintf() calls and simplifies
logger a bit.

This also fixes the problem that json formatter causes a buffer
overflow when there is not enough buffer space.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: check the return value of vsnprintf

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: remove redundant memset

In formmaters, we don't use strlen() against the given buffer now.  No
need to initialize them with zero any more.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: show log priority in sheep.log

This helps us to find important log messages from sheep.log.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>