sheep, dog: runtime loglevel changing

This patch adds two new opcode for runtime loglevel changes and let
dog support the changing from command line. This is useful for making
sheep process verbose temporally and can make troubleshooting easier.

Example of usage:

$ dog node log level list
emerg   (0)
alert   (1)
crit    (2)
err     (3)
warning (4)
notice  (5)
info    (6)
debug   (7)
$ dog node log level get
info (6)
$ dog node log level set debug	# <- change loglevel from info to debug
$ dog node log level get
debug (7)

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>

Conflicts:
	CHANGELOG.md
	dog/common.c
	dog/node.c
	include/internal_proto.h
	sheep/ops.c

Conflicts were resolved by Hitoshi Mitake.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: rotate log with SIGHUP

Current sheep process rotates log when the log file reaches its
maximum size (500MB). But it is not comfortable for periodical backup
of log files.

Rotating log with catching SIGHUP is a common behavior of unix
processes. This patch implements the behavior in sheep daemon.

Example of rog lotation:
$ sudo sheep -P /tmp/sheep/sheep.pid -c local /tmp/sheep
$ sudo kill -SIGHUP `sudo cat /tmp/sheep/sheep.pid`

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>

Conflicts:
	CHANGELOG.md
Conflicts resolved by Hitoshi Mitake.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
sheep: add an option for selecting the output directory of sheep.log

Previously sheep.log was saved in the Sheepdog store directory,
and used size of Sheepdog store directory included log file size.
So, administrator couldn't do capacity planning simply.

This patch adds an option for setting the output directory of sheep.log.

Usage:
	$ sheep -L dir=<log_output_dir>

Example:
	$ sheep -L dir=/logdir /datastore

[ Fixed a over-80 char style by using "?:" operator - Yuan]

Signed-off-by: Teruaki Ishizaki <ishizaki.teruaki@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>

Conflicts:
	sheep/sheep.c

Conflicts resolved by Hitoshi Mitake.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
dog: permit two or more depth of subcommands

Current dog command dies when user invokes "dog node log level set" without any
arguments because of its subcommand design. This patch removes this limitation.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
dog: let usage printing adopt nested subcommands

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>

Conflicts:
	dog/dog.h

Conflicts resolved by Hitoshi Mitake.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>