Colorize Neutron log output and refactor log setup code
Bug 1214616
This patch adds colors to on-screen Neutron log output in the same way nova,
cinder, and heat engine do.
To this aim, colorized logging configuration has been moved to ./functions.
The reason for this refactoring is that these instruction are the same or
very similar for each project, with the only exception of the target
configuration file.
Change-Id: Idf0d1b842bb9ab046c9ef826de1dfc55b3f1df9d
diff --git a/lib/cinder b/lib/cinder
index 7f1544b..bec65ed 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -255,12 +255,9 @@
iniset $CINDER_CONF DEFAULT volume_clear none
fi
+ # Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
- # Add color to logging output
- iniset $CINDER_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(user_id)s %(project_id)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
- iniset $CINDER_CONF DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
- iniset $CINDER_CONF DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m"
- iniset $CINDER_CONF DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m"
+ setup_colorized_logging $CINDER_CONF DEFAULT "project_id" "user_id"
fi
if [ "$CINDER_DRIVER" == "XenAPINFS" ]; then