From f6032ffe6b01384b4c88481611f55e059e8da8b3 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 2 Dec 2014 12:51:07 +0800 Subject: [PATCH] always use system log and context. allow hijack the human print macro. --- trunk/src/libs/srs_librtmp.cpp | 9 +++------ trunk/src/libs/srs_librtmp.hpp | 10 +++++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index d552814f0..2877925b0 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -48,12 +48,9 @@ using namespace std; #include #include -// if want to use your log, define the folowing macro. -#ifndef SRS_HIJACK_LOG - // kernel module. - ISrsLog* _srs_log = new ISrsLog(); - ISrsThreadContext* _srs_context = new ISrsThreadContext(); -#endif +// kernel module. +ISrsLog* _srs_log = new ISrsLog(); +ISrsThreadContext* _srs_context = new ISrsThreadContext(); /** * export runtime context. diff --git a/trunk/src/libs/srs_librtmp.hpp b/trunk/src/libs/srs_librtmp.hpp index 8b90d816f..7a8f3d41d 100644 --- a/trunk/src/libs/srs_librtmp.hpp +++ b/trunk/src/libs/srs_librtmp.hpp @@ -926,9 +926,13 @@ extern int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* dat // log to console, for use srs-librtmp application. extern const char* srs_human_format_time(); -#define srs_human_trace(msg, ...) printf("[%s] ", srs_human_format_time());printf(msg, ##__VA_ARGS__);printf("\n") -#define srs_human_verbose(msg, ...) printf("[%s] ", srs_human_format_time());printf(msg, ##__VA_ARGS__);printf("\n") -#define srs_human_raw(msg, ...) printf(msg, ##__VA_ARGS__) + +// when hijack the log, user will defines this macros. +#ifndef SRS_HIJACK_LOG + #define srs_human_trace(msg, ...) printf("[%s] ", srs_human_format_time());printf(msg, ##__VA_ARGS__);printf("\n") + #define srs_human_verbose(msg, ...) printf("[%s] ", srs_human_format_time());printf(msg, ##__VA_ARGS__);printf("\n") + #define srs_human_raw(msg, ...) printf(msg, ##__VA_ARGS__) +#endif /************************************************************* **************************************************************