Limit len of prefix; makes log tidy w/ long names

PUBLISHED_FROM=570530179da327f8bb156bbbd7c557014c1630c1
This commit is contained in:
Deomid Ryabkov authored and Cesanta Bot committed 2017-01-30 09:24:48 +00:00
1 parent 7988acbff4
commit 2ea63a0ea6
1 file changed
+4 -1
+4 -1
View File
@@ -294,8 +294,11 @@ double cs_log_ts WEAK;
void cs_log_print_prefix(const char *func) WEAK;
void cs_log_print_prefix(const char *func) {
char prefix[21];
strncpy(prefix, func, 20);
prefix[20] = '\0';
if (cs_log_file == NULL) cs_log_file = stderr;
fprintf(cs_log_file, "%-20s ", func);
fprintf(cs_log_file, "%-20s ", prefix);
#if CS_LOG_ENABLE_TS_DIFF
{
double now = cs_time();