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:
commit
fbc35c46aa
1 changed files with 3 additions and 4 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue