winlin

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

@@ -667,7 +667,25 @@ fi @@ -667,7 +667,25 @@ fi
667 667
668 echo "" >> $SRS_AUTO_HEADERS_H 668 echo "" >> $SRS_AUTO_HEADERS_H
669 669
  670 +# for log level compile settings
  671 +if [ $SRS_LOG_VERBOSE = YES ]; then
  672 + echo "#define SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
  673 +else
  674 + echo "#undef SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
  675 +fi
  676 +if [ $SRS_LOG_INFO = YES ]; then
  677 + echo "#define SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
  678 +else
  679 + echo "#undef SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
  680 +fi
  681 +if [ $SRS_LOG_TRACE = YES ]; then
  682 + echo "#define SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
  683 +else
  684 + echo "#undef SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
  685 +fi
  686 +
670 # prefix 687 # prefix
  688 +echo "" >> $SRS_AUTO_HEADERS_H
671 echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H 689 echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
672 690
673 echo "" >> $SRS_AUTO_HEADERS_H 691 echo "" >> $SRS_AUTO_HEADERS_H
@@ -13,6 +13,8 @@ @@ -13,6 +13,8 @@
13 ##################################################################################### 13 #####################################################################################
14 help=no 14 help=no
15 15
  16 +################################################################
  17 +# feature options
16 SRS_HLS=RESERVED 18 SRS_HLS=RESERVED
17 SRS_DVR=RESERVED 19 SRS_DVR=RESERVED
18 SRS_NGINX=RESERVED 20 SRS_NGINX=RESERVED
@@ -37,6 +39,7 @@ SRS_GPERF_CP=RESERVED @@ -37,6 +39,7 @@ SRS_GPERF_CP=RESERVED
37 # gprof 39 # gprof
38 SRS_GPROF=RESERVED 40 SRS_GPROF=RESERVED
39 # 41 #
  42 +################################################################
40 # libraries 43 # libraries
41 SRS_FFMPEG_STUB=RESERVED 44 SRS_FFMPEG_STUB=RESERVED
42 SRS_HTTP_PARSER=RESERVED 45 SRS_HTTP_PARSER=RESERVED
@@ -44,11 +47,18 @@ SRS_HTTP_PARSER=RESERVED @@ -44,11 +47,18 @@ SRS_HTTP_PARSER=RESERVED
44 SRS_PREFIX=/usr/local/srs 47 SRS_PREFIX=/usr/local/srs
45 SRS_JOBS=1 48 SRS_JOBS=1
46 SRS_STATIC=RESERVED 49 SRS_STATIC=RESERVED
  50 +# whether enable the log verbose/info/trace level.
  51 +# always enable the warn/error level.
  52 +SRS_LOG_VERBOSE=RESERVED
  53 +SRS_LOG_INFO=RESERVED
  54 +SRS_LOG_TRACE=RESERVED
47 # 55 #
  56 +################################################################
48 # experts 57 # experts
49 # donot compile ssl, use system ssl(-lssl) if required. 58 # donot compile ssl, use system ssl(-lssl) if required.
50 SRS_USE_SYS_SSL=NO 59 SRS_USE_SYS_SSL=NO
51 # 60 #
  61 +################################################################
52 # presets 62 # presets
53 # for x86/x64 pc/servers 63 # for x86/x64 pc/servers
54 SRS_X86_X64=NO 64 SRS_X86_X64=NO
@@ -77,6 +87,7 @@ SRS_DISABLE_ALL=NO @@ -77,6 +87,7 @@ SRS_DISABLE_ALL=NO
77 # all features is on 87 # all features is on
78 SRS_ENABLE_ALL=NO 88 SRS_ENABLE_ALL=NO
79 # 89 #
  90 +################################################################
80 # calc 91 # calc
81 # whether embed cpu, arm/mips 92 # whether embed cpu, arm/mips
82 SRS_EMBEDED_CPU=NO 93 SRS_EMBEDED_CPU=NO
@@ -141,6 +152,9 @@ Options: @@ -141,6 +152,9 @@ Options:
141 --static whether add '-static' to link options. 152 --static whether add '-static' to link options.
142 --jobs[=N] Allow N jobs at once; infinite jobs with no arg. 153 --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
143 used for make in the configure, for example, to make ffmpeg. 154 used for make in the configure, for example, to make ffmpeg.
  155 + --log-verbose whether enable the log verbose level. default: no.
  156 + --log-info whether enable the log info level. default: no.
  157 + --log-trace whether enable the log trace level. default: yes.
144 158
145 Presets: 159 Presets:
146 --x86-x64 [default] for x86/x64 cpu, common pc and servers. 160 --x86-x64 [default] for x86/x64 cpu, common pc and servers.
@@ -227,6 +241,9 @@ function parse_user_option() { @@ -227,6 +241,9 @@ function parse_user_option() {
227 --jobs) SRS_JOBS=${value} ;; 241 --jobs) SRS_JOBS=${value} ;;
228 --prefix) SRS_PREFIX=${value} ;; 242 --prefix) SRS_PREFIX=${value} ;;
229 --static) SRS_STATIC=YES ;; 243 --static) SRS_STATIC=YES ;;
  244 + --log-verbose) SRS_LOG_VERBOSE=YES ;;
  245 + --log-info) SRS_LOG_INFO=YES ;;
  246 + --log-trace) SRS_LOG_TRACE=YES ;;
230 247
231 --x86-x64) SRS_X86_X64=YES ;; 248 --x86-x64) SRS_X86_X64=YES ;;
232 --arm) SRS_ARM_UBUNTU12=YES ;; 249 --arm) SRS_ARM_UBUNTU12=YES ;;
@@ -279,6 +296,11 @@ if [ $help = yes ]; then @@ -279,6 +296,11 @@ if [ $help = yes ]; then
279 fi 296 fi
280 297
281 function apply_user_presets() { 298 function apply_user_presets() {
  299 + # always set the log level for all presets.
  300 + SRS_LOG_VERBOSE=NO
  301 + SRS_LOG_INFO=NO
  302 + SRS_LOG_TRACE=YES
  303 +
282 # set default preset if not specifies 304 # set default preset if not specifies
283 if [ $SRS_RTMP_HLS = NO ]; then 305 if [ $SRS_RTMP_HLS = NO ]; then
284 if [ $SRS_PURE_RTMP = NO ]; then 306 if [ $SRS_PURE_RTMP = NO ]; then
@@ -687,6 +709,9 @@ function regenerate_options() { @@ -687,6 +709,9 @@ function regenerate_options() {
687 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 709 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
688 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 710 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
689 if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi 711 if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi
  712 + if [ $SRS_LOG_VERBOSE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose"; fi
  713 + if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi
  714 + if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
690 echo "regenerate config: ${SRS_AUTO_CONFIGURE}" 715 echo "regenerate config: ${SRS_AUTO_CONFIGURE}"
691 } 716 }
692 regenerate_options 717 regenerate_options
@@ -167,6 +167,30 @@ ok_msg "test \" ${item} \"" @@ -167,6 +167,30 @@ ok_msg "test \" ${item} \""
167 ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi 167 ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
168 ok_msg "test \" ${item} \" success" 168 ok_msg "test \" ${item} \" success"
169 169
  170 +item="./configure --fast --log-verbose"
  171 +ok_msg "test \" ${item} \""
  172 +(./configure --fast --log-verbose && make) >>$log 2>&1
  173 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
  174 +ok_msg "test \" ${item} \" success"
  175 +
  176 +item="./configure --fast --log-info"
  177 +ok_msg "test \" ${item} \""
  178 +(./configure --fast --log-info && make) >>$log 2>&1
  179 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
  180 +ok_msg "test \" ${item} \" success"
  181 +
  182 +item="./configure --fast --log-trace"
  183 +ok_msg "test \" ${item} \""
  184 +(./configure --fast --log-trace && make) >>$log 2>&1
  185 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
  186 +ok_msg "test \" ${item} \" success"
  187 +
  188 +item="./configure --fast --log-info --log-verbose --log-trace"
  189 +ok_msg "test \" ${item} \""
  190 +(./configure --fast --log-info --log-verbose --log-trace && make) >>$log 2>&1
  191 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test \" ${item} \" failed. ret=$ret"; exit $ret; fi
  192 +ok_msg "test \" ${item} \" success"
  193 +
170 ####################################################################################################### 194 #######################################################################################################
171 ####################################################################################################### 195 #######################################################################################################
172 ####################################################################################################### 196 #######################################################################################################
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "168" 34 +#define VERSION_REVISION "169"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -134,15 +134,15 @@ extern ISrsThreadContext* _srs_context; @@ -134,15 +134,15 @@ extern ISrsThreadContext* _srs_context;
134 #endif 134 #endif
135 135
136 // TODO: FIXME: add more verbose and info logs. 136 // TODO: FIXME: add more verbose and info logs.
137 -#if 1 137 +#ifndef SRS_AUTO_VERBOSE
138 #undef srs_verbose 138 #undef srs_verbose
139 #define srs_verbose(msg, ...) (void)0 139 #define srs_verbose(msg, ...) (void)0
140 #endif 140 #endif
141 -#if 1 141 +#ifndef SRS_AUTO_INFO
142 #undef srs_info 142 #undef srs_info
143 #define srs_info(msg, ...) (void)0 143 #define srs_info(msg, ...) (void)0
144 #endif 144 #endif
145 -#if 0 145 +#ifndef SRS_AUTO_TRACE
146 #undef srs_trace 146 #undef srs_trace
147 #define srs_trace(msg, ...) (void)0 147 #define srs_trace(msg, ...) (void)0
148 #endif 148 #endif