diff mbox

lib: fwts_log_html: remove timestamp as it is in the heading anyhow

Message ID 1338485869-7565-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King May 31, 2012, 5:37 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_log_html.c |   32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

Comments

Keng-Yu Lin June 4, 2012, 8:59 a.m. UTC | #1
On Fri, Jun 1, 2012 at 1:37 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_log_html.c |   32 ++++++++++----------------------
>  1 file changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/src/lib/src/fwts_log_html.c b/src/lib/src/fwts_log_html.c
> index d293dbc..a70ac21 100644
> --- a/src/lib/src/fwts_log_html.c
> +++ b/src/lib/src/fwts_log_html.c
> @@ -63,8 +63,6 @@ static int fwts_log_vprintf_html(fwts_log *log,
>        const char *fmt,
>        va_list args)
>  {
> -       struct tm tm;
> -       time_t now;
>        char *str;
>        char *style;
>        char *code_start;
> @@ -76,18 +74,8 @@ static int fwts_log_vprintf_html(fwts_log *log,
>        if (field & (LOG_NEWLINE | LOG_SEPARATOR | LOG_DEBUG))
>                return 0;
>
> -       time(&now);
> -       localtime_r(&now, &tm);
> -
>        fwts_log_html(log, "<TR>\n");
>
> -       if ((field & LOG_FIELD_MASK) != LOG_HEADING) {
> -               fwts_log_html(log, "  <TD>%2.2d/%2.2d/%-2.2d</TD>\n",
> -                       tm.tm_mday, tm.tm_mon + 1, (tm.tm_year+1900) % 100);
> -               fwts_log_html(log, "  <TD>%2.2d:%2.2d:%2.2d</TD>\n",
> -                       tm.tm_hour, tm.tm_min, tm.tm_sec);
> -       }
> -
>        if (field & LOG_VERBATUM) {
>                code_start = "<PRE class=style_code>";
>                code_end   = "</PRE>";
> @@ -98,22 +86,22 @@ static int fwts_log_vprintf_html(fwts_log *log,
>
>        switch (field & LOG_FIELD_MASK) {
>        case LOG_ERROR:
> -               fwts_log_html(log, "  <TD class=style_error>Error</TD><TD COLSPAN=3>");
> +               fwts_log_html(log, "  <TD class=style_error>Error</TD><TD COLSPAN=2>");
>                vfprintf(log->fp, fmt, args);
>                fprintf(log->fp, "</TD>\n");
>                break;
>        case LOG_WARNING:
> -               fwts_log_html(log, "  <TD class=style_error>Warning</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
> +               fwts_log_html(log, "  <TD class=style_error>Warning</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
>                vfprintf(log->fp, fmt, args);
>                fprintf(log->fp, "%s</TD>\n", code_end);
>                break;
>        case LOG_HEADING:
> -               fwts_log_html(log, "<TD COLSPAN=4 class=style_heading>%s", code_start);
> +               fwts_log_html(log, "<TD COLSPAN=2 class=style_heading>%s", code_start);
>                vfprintf(log->fp, fmt, args);
>                fprintf(log->fp, "%s</TD>\n", code_end);
>                break;
>        case LOG_INFO:
> -               fwts_log_html(log, "  <TD></TD><TD COLSPAN=3 class=style_infos>%s", code_start);
> +               fwts_log_html(log, "  <TD></TD><TD COLSPAN=2 class=style_infos>%s", code_start);
>                vfprintf(log->fp, fmt, args);
>                fprintf(log->fp, "%s</TD>\n", code_end);
>                break;
> @@ -158,13 +146,13 @@ static int fwts_log_vprintf_html(fwts_log *log,
>                break;
>
>        case LOG_SUMMARY:
> -               fwts_log_html(log, "  <TD></TD><TD COLSPAN=3 class=style_summary>%s", code_start);
> +               fwts_log_html(log, "  <TD></TD><TD COLSPAN=2 class=style_summary>%s", code_start);
>                vfprintf(log->fp, fmt, args);
>                fprintf(log->fp, "%s</TD>\n", code_end);
>                break;
>
>        case LOG_ADVICE:
> -               fwts_log_html(log, "  <TD class=style_advice>Advice</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
> +               fwts_log_html(log, "  <TD class=style_advice>Advice</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
>                vfprintf(log->fp, fmt, args);
>                fprintf(log->fp, "%s</TD>\n", code_end);
>                break;
> @@ -204,13 +192,13 @@ static void fwts_log_section_begin_html(fwts_log *log, const char *name)
>        html_stack[html_stack_index].name = name;
>
>        if (!strcmp(name, "summary")) {
> -               fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Summary</TD></TR>\n");
> +               fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Summary</TD></TR>\n");
>        } else if (!strcmp(name, "heading")) {
> -               fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Firmware Test Suite</TD></TR>\n");
> +               fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Firmware Test Suite</TD></TR>\n");
>        } else if (!strcmp(name, "subtest_info")) {
> -               fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=4></TD></TR>\n");
> +               fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=2></TD></TR>\n");
>        } else if (!strcmp(name, "failure")) {
> -               fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4></TD></TR>\n");
> +               fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2></TD></TR>\n");
>        }
>
>        fflush(log->fp);
> --
> 1.7.9.5
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung June 11, 2012, 10:09 a.m. UTC | #2
On 06/01/2012 01:37 AM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/lib/src/fwts_log_html.c |   32 ++++++++++----------------------
>   1 file changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/src/lib/src/fwts_log_html.c b/src/lib/src/fwts_log_html.c
> index d293dbc..a70ac21 100644
> --- a/src/lib/src/fwts_log_html.c
> +++ b/src/lib/src/fwts_log_html.c
> @@ -63,8 +63,6 @@ static int fwts_log_vprintf_html(fwts_log *log,
>   	const char *fmt,
>   	va_list args)
>   {
> -	struct tm tm;
> -	time_t now;
>   	char *str;
>   	char *style;
>   	char *code_start;
> @@ -76,18 +74,8 @@ static int fwts_log_vprintf_html(fwts_log *log,
>   	if (field&  (LOG_NEWLINE | LOG_SEPARATOR | LOG_DEBUG))
>   		return 0;
>
> -	time(&now);
> -	localtime_r(&now,&tm);
> -
>   	fwts_log_html(log, "<TR>\n");
>
> -	if ((field&  LOG_FIELD_MASK) != LOG_HEADING) {
> -		fwts_log_html(log, "<TD>%2.2d/%2.2d/%-2.2d</TD>\n",
> -			tm.tm_mday, tm.tm_mon + 1, (tm.tm_year+1900) % 100);
> -		fwts_log_html(log, "<TD>%2.2d:%2.2d:%2.2d</TD>\n",
> -			tm.tm_hour, tm.tm_min, tm.tm_sec);
> -	}
> -
>   	if (field&  LOG_VERBATUM) {
>   		code_start = "<PRE class=style_code>";
>   		code_end   = "</PRE>";
> @@ -98,22 +86,22 @@ static int fwts_log_vprintf_html(fwts_log *log,
>
>   	switch (field&  LOG_FIELD_MASK) {
>   	case LOG_ERROR:
> -		fwts_log_html(log, "<TD class=style_error>Error</TD><TD COLSPAN=3>");
> +		fwts_log_html(log, "<TD class=style_error>Error</TD><TD COLSPAN=2>");
>   		vfprintf(log->fp, fmt, args);
>   		fprintf(log->fp, "</TD>\n");
>   		break;
>   	case LOG_WARNING:
> -		fwts_log_html(log, "<TD class=style_error>Warning</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
> +		fwts_log_html(log, "<TD class=style_error>Warning</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
>   		vfprintf(log->fp, fmt, args);
>   		fprintf(log->fp, "%s</TD>\n", code_end);
>   		break;
>   	case LOG_HEADING:
> -		fwts_log_html(log, "<TD COLSPAN=4 class=style_heading>%s", code_start);
> +		fwts_log_html(log, "<TD COLSPAN=2 class=style_heading>%s", code_start);
>   		vfprintf(log->fp, fmt, args);
>   		fprintf(log->fp, "%s</TD>\n", code_end);
>   		break;
>   	case LOG_INFO:
> -		fwts_log_html(log, "<TD></TD><TD COLSPAN=3 class=style_infos>%s", code_start);
> +		fwts_log_html(log, "<TD></TD><TD COLSPAN=2 class=style_infos>%s", code_start);
>   		vfprintf(log->fp, fmt, args);
>   		fprintf(log->fp, "%s</TD>\n", code_end);
>   		break;
> @@ -158,13 +146,13 @@ static int fwts_log_vprintf_html(fwts_log *log,
>   		break;
>
>   	case LOG_SUMMARY:
> -		fwts_log_html(log, "<TD></TD><TD COLSPAN=3 class=style_summary>%s", code_start);
> +		fwts_log_html(log, "<TD></TD><TD COLSPAN=2 class=style_summary>%s", code_start);
>   		vfprintf(log->fp, fmt, args);
>   		fprintf(log->fp, "%s</TD>\n", code_end);
>   		break;
>
>   	case LOG_ADVICE:
> -		fwts_log_html(log, "<TD class=style_advice>Advice</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
> +		fwts_log_html(log, "<TD class=style_advice>Advice</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
>   		vfprintf(log->fp, fmt, args);
>   		fprintf(log->fp, "%s</TD>\n", code_end);
>   		break;
> @@ -204,13 +192,13 @@ static void fwts_log_section_begin_html(fwts_log *log, const char *name)
>   	html_stack[html_stack_index].name = name;
>
>   	if (!strcmp(name, "summary")) {
> -		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Summary</TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Summary</TD></TR>\n");
>   	} else if (!strcmp(name, "heading")) {
> -		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Firmware Test Suite</TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Firmware Test Suite</TD></TR>\n");
>   	} else if (!strcmp(name, "subtest_info")) {
> -		fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=4></TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=2></TD></TR>\n");
>   	} else if (!strcmp(name, "failure")) {
> -		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4></TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2></TD></TR>\n");
>   	}
>
>   	fflush(log->fp);
Acked-by: Alex Hung <alex.hung@canonical.com>
Chris Van Hoof June 11, 2012, 3:51 p.m. UTC | #3
On 05/31/2012 01:37 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_log_html.c |   32 ++++++++++----------------------
>  1 file changed, 10 insertions(+), 22 deletions(-)
> 
> diff --git a/src/lib/src/fwts_log_html.c b/src/lib/src/fwts_log_html.c
> index d293dbc..a70ac21 100644
> --- a/src/lib/src/fwts_log_html.c
> +++ b/src/lib/src/fwts_log_html.c
> @@ -63,8 +63,6 @@ static int fwts_log_vprintf_html(fwts_log *log,
>  	const char *fmt,
>  	va_list args)
>  {
> -	struct tm tm;
> -	time_t now;
>  	char *str;
>  	char *style;
>  	char *code_start;
> @@ -76,18 +74,8 @@ static int fwts_log_vprintf_html(fwts_log *log,
>  	if (field & (LOG_NEWLINE | LOG_SEPARATOR | LOG_DEBUG))
>  		return 0;
>  
> -	time(&now);
> -	localtime_r(&now, &tm);
> -
>  	fwts_log_html(log, "<TR>\n");
>  
> -	if ((field & LOG_FIELD_MASK) != LOG_HEADING) {
> -		fwts_log_html(log, "  <TD>%2.2d/%2.2d/%-2.2d</TD>\n",
> -			tm.tm_mday, tm.tm_mon + 1, (tm.tm_year+1900) % 100);
> -		fwts_log_html(log, "  <TD>%2.2d:%2.2d:%2.2d</TD>\n",
> -			tm.tm_hour, tm.tm_min, tm.tm_sec);
> -	}
> -
>  	if (field & LOG_VERBATUM) {
>  		code_start = "<PRE class=style_code>";
>  		code_end   = "</PRE>";
> @@ -98,22 +86,22 @@ static int fwts_log_vprintf_html(fwts_log *log,
>  
>  	switch (field & LOG_FIELD_MASK) {
>  	case LOG_ERROR:
> -		fwts_log_html(log, "  <TD class=style_error>Error</TD><TD COLSPAN=3>");
> +		fwts_log_html(log, "  <TD class=style_error>Error</TD><TD COLSPAN=2>");
>  		vfprintf(log->fp, fmt, args);
>  		fprintf(log->fp, "</TD>\n");
>  		break;
>  	case LOG_WARNING:
> -		fwts_log_html(log, "  <TD class=style_error>Warning</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
> +		fwts_log_html(log, "  <TD class=style_error>Warning</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
>  		vfprintf(log->fp, fmt, args);
>  		fprintf(log->fp, "%s</TD>\n", code_end);
>  		break;
>  	case LOG_HEADING:
> -		fwts_log_html(log, "<TD COLSPAN=4 class=style_heading>%s", code_start);
> +		fwts_log_html(log, "<TD COLSPAN=2 class=style_heading>%s", code_start);
>  		vfprintf(log->fp, fmt, args);
>  		fprintf(log->fp, "%s</TD>\n", code_end);
>  		break;
>  	case LOG_INFO:
> -		fwts_log_html(log, "  <TD></TD><TD COLSPAN=3 class=style_infos>%s", code_start);
> +		fwts_log_html(log, "  <TD></TD><TD COLSPAN=2 class=style_infos>%s", code_start);
>  		vfprintf(log->fp, fmt, args);
>  		fprintf(log->fp, "%s</TD>\n", code_end);
>  		break;
> @@ -158,13 +146,13 @@ static int fwts_log_vprintf_html(fwts_log *log,
>  		break;
>  
>  	case LOG_SUMMARY:
> -		fwts_log_html(log, "  <TD></TD><TD COLSPAN=3 class=style_summary>%s", code_start);
> +		fwts_log_html(log, "  <TD></TD><TD COLSPAN=2 class=style_summary>%s", code_start);
>  		vfprintf(log->fp, fmt, args);
>  		fprintf(log->fp, "%s</TD>\n", code_end);
>  		break;
>  
>  	case LOG_ADVICE:
> -		fwts_log_html(log, "  <TD class=style_advice>Advice</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
> +		fwts_log_html(log, "  <TD class=style_advice>Advice</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
>  		vfprintf(log->fp, fmt, args);
>  		fprintf(log->fp, "%s</TD>\n", code_end);
>  		break;
> @@ -204,13 +192,13 @@ static void fwts_log_section_begin_html(fwts_log *log, const char *name)
>  	html_stack[html_stack_index].name = name;
>  
>  	if (!strcmp(name, "summary")) {
> -		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Summary</TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Summary</TD></TR>\n");
>  	} else if (!strcmp(name, "heading")) {
> -		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Firmware Test Suite</TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Firmware Test Suite</TD></TR>\n");
>  	} else if (!strcmp(name, "subtest_info")) {
> -		fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=4></TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=2></TD></TR>\n");
>  	} else if (!strcmp(name, "failure")) {
> -		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4></TD></TR>\n");
> +		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2></TD></TR>\n");
>  	}
>  
>  	fflush(log->fp);

Tested-by: Chris Van Hoof <vanhoof@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_log_html.c b/src/lib/src/fwts_log_html.c
index d293dbc..a70ac21 100644
--- a/src/lib/src/fwts_log_html.c
+++ b/src/lib/src/fwts_log_html.c
@@ -63,8 +63,6 @@  static int fwts_log_vprintf_html(fwts_log *log,
 	const char *fmt,
 	va_list args)
 {
-	struct tm tm;
-	time_t now;
 	char *str;
 	char *style;
 	char *code_start;
@@ -76,18 +74,8 @@  static int fwts_log_vprintf_html(fwts_log *log,
 	if (field & (LOG_NEWLINE | LOG_SEPARATOR | LOG_DEBUG))
 		return 0;
 
-	time(&now);
-	localtime_r(&now, &tm);
-
 	fwts_log_html(log, "<TR>\n");
 
-	if ((field & LOG_FIELD_MASK) != LOG_HEADING) {
-		fwts_log_html(log, "  <TD>%2.2d/%2.2d/%-2.2d</TD>\n",
-			tm.tm_mday, tm.tm_mon + 1, (tm.tm_year+1900) % 100);
-		fwts_log_html(log, "  <TD>%2.2d:%2.2d:%2.2d</TD>\n",
-			tm.tm_hour, tm.tm_min, tm.tm_sec);
-	}
-
 	if (field & LOG_VERBATUM) {
 		code_start = "<PRE class=style_code>";
 		code_end   = "</PRE>";
@@ -98,22 +86,22 @@  static int fwts_log_vprintf_html(fwts_log *log,
 
 	switch (field & LOG_FIELD_MASK) {
 	case LOG_ERROR:
-		fwts_log_html(log, "  <TD class=style_error>Error</TD><TD COLSPAN=3>");
+		fwts_log_html(log, "  <TD class=style_error>Error</TD><TD COLSPAN=2>");
 		vfprintf(log->fp, fmt, args);
 		fprintf(log->fp, "</TD>\n");
 		break;
 	case LOG_WARNING:
-		fwts_log_html(log, "  <TD class=style_error>Warning</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
+		fwts_log_html(log, "  <TD class=style_error>Warning</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
 		vfprintf(log->fp, fmt, args);
 		fprintf(log->fp, "%s</TD>\n", code_end);
 		break;
 	case LOG_HEADING:
-		fwts_log_html(log, "<TD COLSPAN=4 class=style_heading>%s", code_start);
+		fwts_log_html(log, "<TD COLSPAN=2 class=style_heading>%s", code_start);
 		vfprintf(log->fp, fmt, args);
 		fprintf(log->fp, "%s</TD>\n", code_end);
 		break;
 	case LOG_INFO:
-		fwts_log_html(log, "  <TD></TD><TD COLSPAN=3 class=style_infos>%s", code_start);
+		fwts_log_html(log, "  <TD></TD><TD COLSPAN=2 class=style_infos>%s", code_start);
 		vfprintf(log->fp, fmt, args);
 		fprintf(log->fp, "%s</TD>\n", code_end);
 		break;
@@ -158,13 +146,13 @@  static int fwts_log_vprintf_html(fwts_log *log,
 		break;
 
 	case LOG_SUMMARY:
-		fwts_log_html(log, "  <TD></TD><TD COLSPAN=3 class=style_summary>%s", code_start);
+		fwts_log_html(log, "  <TD></TD><TD COLSPAN=2 class=style_summary>%s", code_start);
 		vfprintf(log->fp, fmt, args);
 		fprintf(log->fp, "%s</TD>\n", code_end);
 		break;
 
 	case LOG_ADVICE:
-		fwts_log_html(log, "  <TD class=style_advice>Advice</TD><TD COLSPAN=3 class=style_advice_info>%s", code_start);
+		fwts_log_html(log, "  <TD class=style_advice>Advice</TD><TD COLSPAN=2 class=style_advice_info>%s", code_start);
 		vfprintf(log->fp, fmt, args);
 		fprintf(log->fp, "%s</TD>\n", code_end);
 		break;
@@ -204,13 +192,13 @@  static void fwts_log_section_begin_html(fwts_log *log, const char *name)
 	html_stack[html_stack_index].name = name;
 
 	if (!strcmp(name, "summary")) {
-		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Summary</TD></TR>\n");
+		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Summary</TD></TR>\n");
 	} else if (!strcmp(name, "heading")) {
-		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4>Firmware Test Suite</TD></TR>\n");
+		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2>Firmware Test Suite</TD></TR>\n");
 	} else if (!strcmp(name, "subtest_info")) {
-		fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=4></TD></TR>\n");
+		fwts_log_html(log, "<TR><TD class=style_subtest COLSPAN=2></TD></TR>\n");
 	} else if (!strcmp(name, "failure")) {
-		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=4></TD></TR>\n");
+		fwts_log_html(log, "<TR><TD class=style_heading COLSPAN=2></TD></TR>\n");
 	}
 
 	fflush(log->fp);