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

Merge pull request #271 from tufang14/master

Update srs_app_log.cpp for #271
This commit is contained in:
winlin 2015-01-02 12:36:08 +08:00
commit fbc35c46aa

View file

@ -326,7 +326,6 @@ void SrsFastLog::write_log(int& fd, char *str_log, int size, int level)
// add some to the end of char. // add some to the end of char.
str_log[size++] = LOG_TAIL; str_log[size++] = LOG_TAIL;
str_log[size++] = 0;
// if not to file, to console and return. // if not to file, to console and return.
if (!log_to_file_tank) { if (!log_to_file_tank) {
@ -336,11 +335,11 @@ void SrsFastLog::write_log(int& fd, char *str_log, int size, int level)
// \033[33m : yellow text code in shell // \033[33m : yellow text code in shell
// \033[0m : normal text code // \033[0m : normal text code
if (level <= SrsLogLevel::Trace) { if (level <= SrsLogLevel::Trace) {
printf("%s", str_log); printf("%.*s", size, str_log);
} else if (level == SrsLogLevel::Warn) { } else if (level == SrsLogLevel::Warn) {
printf("\033[33m%s\033[0m", str_log); printf("\033[33m%.*s\033[0m", size, str_log);
} else{ } else{
printf("\033[31m%s\033[0m", str_log); printf("\033[31m%.*s\033[0m", size, str_log);
} }
return; return;