-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
7,849 additions
and
9,168 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,57 @@ | ||
#include "log.h" | ||
#include "misc.h" | ||
|
||
int log_level=log_info; | ||
int log_level = log_info; | ||
|
||
int enable_log_position=0; | ||
int enable_log_color=1; | ||
int enable_log_position = 0; | ||
int enable_log_color = 1; | ||
|
||
void log0(const char * file,const char * function,int line,int level,const char* str, ...) { | ||
void log0(const char* file, const char* function, int line, int level, const char* str, ...) { | ||
if (level > log_level) return; | ||
if (level > log_trace || level < 0) return; | ||
|
||
if(level>log_level) return ; | ||
if(level>log_trace||level<0) return ; | ||
time_t timer; | ||
char buffer[100]; | ||
struct tm* tm_info; | ||
|
||
time(&timer); | ||
tm_info = localtime(&timer); | ||
|
||
time_t timer; | ||
char buffer[100]; | ||
struct tm* tm_info; | ||
if (enable_log_color) | ||
printf("%s", log_color[level]); | ||
|
||
time(&timer); | ||
tm_info = localtime(&timer); | ||
strftime(buffer, 100, "%Y-%m-%d %H:%M:%S", tm_info); | ||
printf("[%s][%s]", buffer, log_text[level]); | ||
|
||
if(enable_log_color) | ||
printf("%s",log_color[level]); | ||
if (enable_log_position) printf("[%s,func:%s,line:%d]", file, function, line); | ||
|
||
strftime(buffer, 100, "%Y-%m-%d %H:%M:%S", tm_info); | ||
printf("[%s][%s]",buffer,log_text[level]); | ||
va_list vlist; | ||
va_start(vlist, str); | ||
vfprintf(stdout, str, vlist); | ||
va_end(vlist); | ||
if (enable_log_color) | ||
printf("%s", RESET); | ||
|
||
if(enable_log_position)printf("[%s,func:%s,line:%d]",file,function,line); | ||
// printf("\n"); | ||
// if(enable_log_color) | ||
// printf(log_color[level]); | ||
fflush(stdout); | ||
|
||
va_list vlist; | ||
va_start(vlist, str); | ||
vfprintf(stdout, str, vlist); | ||
va_end(vlist); | ||
if(enable_log_color) | ||
printf("%s",RESET); | ||
|
||
//printf("\n"); | ||
//if(enable_log_color) | ||
//printf(log_color[level]); | ||
fflush(stdout); | ||
|
||
if(log_level==log_fatal) | ||
{ | ||
about_to_exit=1; | ||
} | ||
if (log_level == log_fatal) { | ||
about_to_exit = 1; | ||
} | ||
} | ||
|
||
void log_bare(int level,const char* str, ...) | ||
{ | ||
if(level>log_level) return ; | ||
if(level>log_trace||level<0) return ; | ||
if(enable_log_color) | ||
printf("%s",log_color[level]); | ||
va_list vlist; | ||
va_start(vlist, str); | ||
vfprintf(stdout, str, vlist); | ||
va_end(vlist); | ||
if(enable_log_color) | ||
printf("%s",RESET); | ||
fflush(stdout); | ||
|
||
void log_bare(int level, const char* str, ...) { | ||
if (level > log_level) return; | ||
if (level > log_trace || level < 0) return; | ||
if (enable_log_color) | ||
printf("%s", log_color[level]); | ||
va_list vlist; | ||
va_start(vlist, str); | ||
vfprintf(stdout, str, vlist); | ||
va_end(vlist); | ||
if (enable_log_color) | ||
printf("%s", RESET); | ||
fflush(stdout); | ||
} |
Oops, something went wrong.