Cache group name in sys_logger_t to avoid problems with Vstr.

Because syslog(3) is not replaced when using the Vstr wrapper, %N can
not be resolved properly.
This commit is contained in:
Tobias Brunner
2011-05-03 10:50:28 +02:00
parent b7cb8100c4
commit b4c9ab9c79
+5 -3
View File
@@ -54,11 +54,13 @@ METHOD(listener_t, log_, bool,
{
if (level <= this->levels[group])
{
char buffer[8192], namestr[128] = "";
char buffer[8192], groupstr[4], namestr[128] = "";
char *current = buffer, *next;
/* write in memory buffer first */
vsnprintf(buffer, sizeof(buffer), format, args);
/* cache group name */
snprintf(groupstr, sizeof(groupstr), "%N", debug_names, group);
if (this->ike_name && ike_sa)
{
@@ -82,8 +84,8 @@ METHOD(listener_t, log_, bool,
{
*(next++) = '\0';
}
syslog(this->facility|LOG_INFO, "%.2d[%N]%s %s\n",
thread, debug_names, group, namestr, current);
syslog(this->facility|LOG_INFO, "%.2d[%s]%s %s\n",
thread, groupstr, namestr, current);
current = next;
}
}