1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

add configure options --log-verbose/info/trace to compile log macros. 0.9.169

This commit is contained in:
winlin 2014-07-23 14:37:54 +08:00
parent fd8c4989f5
commit f562a98602
5 changed files with 71 additions and 4 deletions

View file

@ -667,7 +667,25 @@ fi
echo "" >> $SRS_AUTO_HEADERS_H
# for log level compile settings
if [ $SRS_LOG_VERBOSE = YES ]; then
echo "#define SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_LOG_INFO = YES ]; then
echo "#define SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_LOG_TRACE = YES ]; then
echo "#define SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
fi
# prefix
echo "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H

View file

@ -13,6 +13,8 @@
#####################################################################################
help=no
################################################################
# feature options
SRS_HLS=RESERVED
SRS_DVR=RESERVED
SRS_NGINX=RESERVED
@ -37,6 +39,7 @@ SRS_GPERF_CP=RESERVED
# gprof
SRS_GPROF=RESERVED
#
################################################################
# libraries
SRS_FFMPEG_STUB=RESERVED
SRS_HTTP_PARSER=RESERVED
@ -44,11 +47,18 @@ SRS_HTTP_PARSER=RESERVED
SRS_PREFIX=/usr/local/srs
SRS_JOBS=1
SRS_STATIC=RESERVED
# whether enable the log verbose/info/trace level.
# always enable the warn/error level.
SRS_LOG_VERBOSE=RESERVED
SRS_LOG_INFO=RESERVED
SRS_LOG_TRACE=RESERVED
#
################################################################
# experts
# donot compile ssl, use system ssl(-lssl) if required.
SRS_USE_SYS_SSL=NO
#
################################################################
# presets
# for x86/x64 pc/servers
SRS_X86_X64=NO
@ -77,6 +87,7 @@ SRS_DISABLE_ALL=NO
# all features is on
SRS_ENABLE_ALL=NO
#
################################################################
# calc
# whether embed cpu, arm/mips
SRS_EMBEDED_CPU=NO
@ -141,6 +152,9 @@ Options:
--static whether add '-static' to link options.
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
--log-verbose whether enable the log verbose level. default: no.
--log-info whether enable the log info level. default: no.
--log-trace whether enable the log trace level. default: yes.
Presets:
--x86-x64 [default] for x86/x64 cpu, common pc and servers.
@ -227,6 +241,9 @@ function parse_user_option() {
--jobs) SRS_JOBS=${value} ;;
--prefix) SRS_PREFIX=${value} ;;
--static) SRS_STATIC=YES ;;
--log-verbose) SRS_LOG_VERBOSE=YES ;;
--log-info) SRS_LOG_INFO=YES ;;
--log-trace) SRS_LOG_TRACE=YES ;;
--x86-x64) SRS_X86_X64=YES ;;
--arm) SRS_ARM_UBUNTU12=YES ;;
@ -279,6 +296,11 @@ if [ $help = yes ]; then
fi
function apply_user_presets() {
# always set the log level for all presets.
SRS_LOG_VERBOSE=NO
SRS_LOG_INFO=NO
SRS_LOG_TRACE=YES
# set default preset if not specifies
if [ $SRS_RTMP_HLS = NO ]; then
if [ $SRS_PURE_RTMP = NO ]; then
@ -687,6 +709,9 @@ function regenerate_options() {
if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-arm-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-arm-ubuntu12"; fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-mips-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-mips-ubuntu12"; fi
if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi
if [ $SRS_LOG_VERBOSE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose"; fi
if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
echo "regenerate config: ${SRS_AUTO_CONFIGURE}"
}
regenerate_options

View file

@ -167,6 +167,30 @@ ok_msg "test \" ${item} \""
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
ok_msg "test \" ${item} \" success"
item="./configure --fast --log-verbose"
ok_msg "test \" ${item} \""
(./configure --fast --log-verbose && make) >>$log 2>&1
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
ok_msg "test \" ${item} \" success"
item="./configure --fast --log-info"
ok_msg "test \" ${item} \""
(./configure --fast --log-info && make) >>$log 2>&1
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
ok_msg "test \" ${item} \" success"
item="./configure --fast --log-trace"
ok_msg "test \" ${item} \""
(./configure --fast --log-trace && make) >>$log 2>&1
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
ok_msg "test \" ${item} \" success"
item="./configure --fast --log-info --log-verbose --log-trace"
ok_msg "test \" ${item} \""
(./configure --fast --log-info --log-verbose --log-trace && make) >>$log 2>&1
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
ok_msg "test \" ${item} \" success"
#######################################################################################################
#######################################################################################################
#######################################################################################################

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "168"
#define VERSION_REVISION "169"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"

View file

@ -134,15 +134,15 @@ extern ISrsThreadContext* _srs_context;
#endif
// TODO: FIXME: add more verbose and info logs.
#if 1
#ifndef SRS_AUTO_VERBOSE
#undef srs_verbose
#define srs_verbose(msg, ...) (void)0
#endif
#if 1
#ifndef SRS_AUTO_INFO
#undef srs_info
#define srs_info(msg, ...) (void)0
#endif
#if 0
#ifndef SRS_AUTO_TRACE
#undef srs_trace
#define srs_trace(msg, ...) (void)0
#endif