Merge branch 'dev'
This commit is contained in:
+9
-3
@@ -306,11 +306,17 @@ static inline void uc_vlog_internal(const struct uc_log_args *args, const char *
|
|||||||
if(dest->dest_type != UC_LDEST_SYSLOG && dest->type.file.file != NULL) {
|
if(dest->dest_type != UC_LDEST_SYSLOG && dest->type.file.file != NULL) {
|
||||||
char time_buf[48];
|
char time_buf[48];
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm tmbuf;
|
struct tm t;
|
||||||
|
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
localtime_r(&now, &tmbuf);
|
localtime_r(&now, &t);
|
||||||
strftime(time_buf, sizeof time_buf, "%d %b %Y %H:%M:%S %Z", &tmbuf);
|
snprintf(time_buf, sizeof time_buf, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||||
|
t.tm_year + 1900,
|
||||||
|
t.tm_mon + 1,
|
||||||
|
t.tm_mday,
|
||||||
|
t.tm_hour,
|
||||||
|
t.tm_min,
|
||||||
|
t.tm_sec);
|
||||||
|
|
||||||
if(dest->log_location) {
|
if(dest->log_location) {
|
||||||
fprintf(dest->type.file.file, "[%s] %s %s:%d [%s] : ", uc_ll_2_str(args->log_level),
|
fprintf(dest->type.file.file, "[%s] %s %s:%d [%s] : ", uc_ll_2_str(args->log_level),
|
||||||
|
|||||||
+8
-8
@@ -56,7 +56,7 @@ START_TEST (test_logfile_location)
|
|||||||
|
|
||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 79*2, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 74*2, "was %ld\n", (long)st.st_size);
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (test_logfile_no_location)
|
START_TEST (test_logfile_no_location)
|
||||||
@@ -86,7 +86,7 @@ START_TEST (test_logfile_no_location)
|
|||||||
|
|
||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 55*2, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 50*2, "was %ld\n", (long)st.st_size);
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (test_logfile_loglevel_surpressed_dest)
|
START_TEST (test_logfile_loglevel_surpressed_dest)
|
||||||
@@ -118,7 +118,7 @@ START_TEST (test_logfile_loglevel_surpressed_dest)
|
|||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
|
|
||||||
fail_if(st.st_size != 0, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 0, "was %ld\n", (long)st.st_size);
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (test_logfile_loglevel_surpressed_module)
|
START_TEST (test_logfile_loglevel_surpressed_module)
|
||||||
@@ -150,7 +150,7 @@ START_TEST (test_logfile_loglevel_surpressed_module)
|
|||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
|
|
||||||
fail_if(st.st_size != 0, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 0, "was %ld\n", (long)st.st_size);
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST (test_logfile_reopen_files)
|
START_TEST (test_logfile_reopen_files)
|
||||||
@@ -180,7 +180,7 @@ START_TEST (test_logfile_reopen_files)
|
|||||||
|
|
||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 80*2, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 75*2, "was %ld\n", (long)st.st_size);
|
||||||
|
|
||||||
rc = remove(FILE_NAME);
|
rc = remove(FILE_NAME);
|
||||||
fail_if(rc != 0, "Remove failed %s\n", strerror(errno));
|
fail_if(rc != 0, "Remove failed %s\n", strerror(errno));
|
||||||
@@ -192,7 +192,7 @@ START_TEST (test_logfile_reopen_files)
|
|||||||
|
|
||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "2. stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "2. stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 80, "was %ld\n", (long)st.st_size);//should only one line there now
|
fail_if(st.st_size != 75, "was %ld\n", (long)st.st_size);//should only one line there now
|
||||||
|
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ START_TEST (test_logfile_remove_dest)
|
|||||||
|
|
||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 80*2, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 75*2, "was %ld\n", (long)st.st_size);
|
||||||
|
|
||||||
uc_log_remove_destination(dest1);
|
uc_log_remove_destination(dest1);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ START_TEST (test_logfile_remove_dest)
|
|||||||
|
|
||||||
rc = stat(FILE_NAME, &st);
|
rc = stat(FILE_NAME, &st);
|
||||||
fail_if(rc != 0, "2. stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "2. stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 80*2, "was %ld\n", (long)st.st_size);//should be same size
|
fail_if(st.st_size != 75*2, "was %ld\n", (long)st.st_size);//should be same size
|
||||||
|
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user