/* log.c - Diagnostic and error logging
* Copyright 2000-2004 srvx Development Team
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of srvx.
+ *
+ * srvx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version. Important limitations are
- * listed in the COPYING file that accompanies this software.
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, email srvx-maintainers@srvx.net.
+ * along with srvx; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "conf.h"
* KEY := LOGSET '.' SEVSET
* LOGSET := LOGLIT | LOGLIT ',' LOGSET
* LOGLIT := a registered log type
- * SEVSET := '*' | SEVLIT | '<' SEVLIT | '<=' SEVLIT | '>' SEVLIT | '>=' SEVLIT | SEVLIG ',' SEVSET
+ * SEVSET := '*' | SEVLIT | '<' SEVLIT | '<=' SEVLIT | '>' SEVLIT | '>=' SEVLIT | SEVLIT ',' SEVSET
* SEVLIT := one of log_severity_names
* A KEY contains the Cartesian product of the logs in its LOGSET
* and the severities in its SEVSET.
int first;
cont = strchr(buffer, ',');
- if (cont) *cont++ = 0;
+ if (cont)
+ *cont++ = 0;
if (buffer[0] == '*' && buffer[1] == 0) {
for (bound = 0; bound < LOG_NUM_SEVERITIES; bound++) {
/* make people explicitly specify replay targets */
}
}
} else {
+ if (buffer[0] == '=')
+ buffer++;
bound = find_severity(buffer);
targets[bound] = 1;
}
for (ii = 0; ii < slist->used; ++ii) {
type = log_register_type(slist->list[ii], NULL);
for (sev = 0; sev < LOG_NUM_SEVERITIES; ++sev) {
- if (!sevset[sev]) continue;
+ if (!sevset[sev])
+ continue;
logList_join(&type->logs[sev], &logList);
}
}
unsigned int matched = 0;
if (discrim->type) {
- struct logEntry *entry;
+ struct logEntry *entry, *last;
- for (entry = discrim->type->log_oldest; entry; entry = entry->next) {
+ for (entry = discrim->type->log_oldest, last = NULL;
+ entry;
+ last = entry, entry = entry->next) {
+ verify(entry);
if (entry_match(discrim, entry)) {
esf(entry, data);
if (++matched >= discrim->limit)