r9023@Kushana: nickm | 2006-09-29 17:27:24 -0400

Make distinct all non-bug messages at notice or higher that appear 3 or more times.


svn:r8541
This commit is contained in:
Nick Mathewson 2006-09-29 22:33:34 +00:00
parent 9027491ae1
commit 8308a37908
8 changed files with 35 additions and 32 deletions

View File

@ -79,7 +79,7 @@ tor_gzip_compress(char **out, size_t *out_len,
if (method == GZIP_METHOD && !is_gzip_supported()) {
/* Old zlib version don't support gzip in deflateInit2 */
log_warn(LD_GENERAL, "Gzip not supported with zlib %s", ZLIB_VERSION);
log_warn(LD_BUG, "Gzip not supported with zlib %s", ZLIB_VERSION);
return -1;
}
@ -132,7 +132,7 @@ tor_gzip_compress(char **out, size_t *out_len,
done:
*out_len = stream->total_out;
if (deflateEnd(stream)!=Z_OK) {
log_warn(LD_GENERAL, "Error freeing gzip structures");
log_warn(LD_BUG, "Error freeing gzip structures");
goto err;
}
tor_free(stream);
@ -178,7 +178,7 @@ tor_gzip_uncompress(char **out, size_t *out_len,
if (method == GZIP_METHOD && !is_gzip_supported()) {
/* Old zlib version don't support gzip in inflateInit2 */
log_warn(LD_GENERAL, "Gzip not supported with zlib %s", ZLIB_VERSION);
log_warn(LD_BUG, "Gzip not supported with zlib %s", ZLIB_VERSION);
return -1;
}
@ -213,7 +213,7 @@ tor_gzip_uncompress(char **out, size_t *out_len,
goto done;
/* There may be more compressed data here. */
if ((r = inflateEnd(stream)) != Z_OK) {
log_warn(LD_GENERAL, "Error freeing gzip structures");
log_warn(LD_BUG, "Error freeing gzip structures");
goto err;
}
if (inflateInit2(stream, method_bits(method)) != Z_OK) {
@ -251,7 +251,7 @@ tor_gzip_uncompress(char **out, size_t *out_len,
r = inflateEnd(stream);
tor_free(stream);
if (r != Z_OK) {
log_warn(LD_GENERAL, "Error freeing gzip structures");
log_warn(LD_BUG, "Error freeing gzip structures");
goto err;
}
@ -304,7 +304,7 @@ tor_zlib_new(int compress, compress_method_t method)
if (method == GZIP_METHOD && !is_gzip_supported()) {
/* Old zlib version don't support gzip in inflateInit2 */
log_warn(LD_GENERAL, "Gzip not supported with zlib %s", ZLIB_VERSION);
log_warn(LD_BUG, "Gzip not supported with zlib %s", ZLIB_VERSION);
return NULL;
}

View File

@ -115,7 +115,7 @@ _tor_malloc(size_t size DMALLOC_PARAMS)
result = dmalloc_malloc(file, line, size, DMALLOC_FUNC_MALLOC, 0, 0);
if (PREDICT(result == NULL, 0)) {
log_err(LD_MM,"Out of memory. Dying.");
log_err(LD_MM,"Out of memory on malloc(). Dying.");
/* If these functions die within a worker process, they won't call
* spawn_exit, but that's ok, since the parent will run out of memory soon
* anyway. */
@ -147,7 +147,7 @@ _tor_realloc(void *ptr, size_t size DMALLOC_PARAMS)
result = dmalloc_realloc(file, line, ptr, size, DMALLOC_FUNC_REALLOC, 0);
if (PREDICT(result == NULL, 0)) {
log_err(LD_MM,"Out of memory. Dying.");
log_err(LD_MM,"Out of memory on realloc(). Dying.");
exit(1);
}
return result;
@ -165,7 +165,7 @@ _tor_strdup(const char *s DMALLOC_PARAMS)
dup = dmalloc_strdup(file, line, s, 0);
if (PREDICT(dup == NULL, 0)) {
log_err(LD_MM,"Out of memory. Dying.");
log_err(LD_MM,"Out of memory on strdup(). Dying.");
exit(1);
}
return dup;

View File

@ -2930,8 +2930,8 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
char *tmp_sev = tor_strndup(range, cp - range);
levelMin = parse_log_level(tmp_sev);
if (levelMin < 0) {
log_warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
"err|warn|notice|info|debug", tmp_sev);
log_warn(LD_CONFIG, "Unrecognized minimum log severity '%s': must be "
"one of err|warn|notice|info|debug", tmp_sev);
tor_free(tmp_sev);
return -1;
}
@ -2942,8 +2942,8 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
} else {
levelMax = parse_log_level(cp+1);
if (levelMax < 0) {
log_warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
"err|warn|notice|info|debug", cp+1);
log_warn(LD_CONFIG, "Unrecognized maximum log severity '%s': must be "
"one of err|warn|notice|info|debug", cp+1);
return -1;
}
}
@ -3025,7 +3025,7 @@ options_init_logs(or_options_t *options, int validate_only)
smartlist_split_string(elts, opt->value, NULL,
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 3);
if (smartlist_len(elts) == 0) {
log_warn(LD_CONFIG, "Bad syntax on Log option 'Log %s'", opt->value);
log_warn(LD_CONFIG, "No arguments to Log option 'Log %s'", opt->value);
ok = 0; goto cleanup;
}
if (parse_log_severity_range(smartlist_get(elts,0), &levelMin,
@ -3045,7 +3045,8 @@ options_init_logs(or_options_t *options, int validate_only)
}
if (!strcasecmp(smartlist_get(elts,1), "file")) {
if (smartlist_len(elts) != 3) {
log_warn(LD_CONFIG, "Bad syntax on Log option 'Log %s'", opt->value);
log_warn(LD_CONFIG, "Bad syntax on file Log option 'Log %s'",
opt->value);
ok = 0; goto cleanup;
}
if (!validate_only) {
@ -3057,7 +3058,8 @@ options_init_logs(or_options_t *options, int validate_only)
goto cleanup;
}
if (smartlist_len(elts) != 2) {
log_warn(LD_CONFIG, "Bad syntax on Log option 'Log %s'", opt->value);
log_warn(LD_CONFIG, "Wrong number of arguments on Log option 'Log %s'",
opt->value);
ok = 0; goto cleanup;
}
if (!strcasecmp(smartlist_get(elts,1), "stdout")) {
@ -3263,8 +3265,8 @@ parse_dir_server_line(const char *line, int validate_only)
items = smartlist_create();
smartlist_split_string(items, line, NULL,
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, -1);
if (smartlist_len(items) < 2) {
log_warn(LD_CONFIG, "Too few arguments to DirServer line.");
if (smartlist_len(items) < 1) {
log_warn(LD_CONFIG, "No arguments on DirServer line.");
goto err;
}

View File

@ -654,7 +654,7 @@ connection_create_listener(const char *listenaddress, uint16_t listenport,
conn->port = usePort;
if (connection_add(conn) < 0) { /* no space, forget it */
log_warn(LD_NET,"connection_add failed. Giving up.");
log_warn(LD_NET,"connection_add for listener failed. Giving up.");
connection_free(conn);
goto err;
}

View File

@ -348,7 +348,7 @@ spawn_cpuworker(void)
conn->address = tor_strdup("localhost");
if (connection_add(conn) < 0) { /* no space, forget it */
log_warn(LD_NET,"connection_add failed. Giving up.");
log_warn(LD_NET,"connection_add for cpuworker failed. Giving up.");
connection_free(conn); /* this closes fd */
return -1;
}
@ -374,7 +374,7 @@ spawn_enough_cpuworkers(void)
while (num_cpuworkers < num_cpuworkers_needed) {
if (spawn_cpuworker() < 0) {
log_warn(LD_GENERAL,"Spawn failed. Will try again later.");
log_warn(LD_GENERAL,"Cpuworker spawn failed. Will try again later.");
return;
}
num_cpuworkers++;

View File

@ -1308,7 +1308,7 @@ spawn_dnsworker(void)
conn->address = tor_strdup("<unused>");
if (connection_add(conn) < 0) { /* no space, forget it */
log_warn(LD_NET,"connection_add failed. Giving up.");
log_warn(LD_NET,"connection_add for dnsworker failed. Giving up.");
connection_free(conn); /* this closes fd */
return -1;
}
@ -1362,7 +1362,7 @@ spawn_enough_dnsworkers(void)
while (num_dnsworkers < num_dnsworkers_needed) {
if (spawn_dnsworker() < 0) {
log_warn(LD_EXIT,"Spawn failed. Will try again later.");
log_warn(LD_EXIT,"DNS worker spawn failed. Will try again later.");
return -1;
}
num_dnsworkers++;

View File

@ -2492,10 +2492,11 @@ router_get_combined_status_by_nickname(const char *nickname,
char fp[HEX_DIGEST_LEN+1];
base16_encode(fp, sizeof(fp),
best->status.identity_digest, DIGEST_LEN);
log_warn(LD_CONFIG, "You specified a server \"%s\" by name, but the "
"directory authorities do not have a binding for this nickname. "
"To make sure you get the same server in the future, refer to "
"it by key, as \"$%s\".", nickname, fp);
log_warn(LD_CONFIG,
"To look up a status, you specified a server \"%s\" by name, but the "
"directory authorities do not have a binding for this nickname. "
"To make sure you get the same server in the future, refer to "
"it by key, as \"$%s\".", nickname, fp);
best->name_lookup_warned = 1;
}
smartlist_free(matches);

View File

@ -481,7 +481,7 @@ router_parse_runningrouters(const char *str)
}
if (!(tok = find_first_by_keyword(tokens, K_PUBLISHED))) {
log_warn(LD_DIR, "Missing published time on directory.");
log_warn(LD_DIR, "Missing published time on running-routers.");
goto err;
}
tor_assert(tok->n_args == 1);
@ -818,7 +818,7 @@ router_parse_entry_from_string(const char *s, const char *end,
}
if (!(tok = find_first_by_keyword(tokens, K_PUBLISHED))) {
log_warn(LD_DIR, "Missing published time"); goto err;
log_warn(LD_DIR, "Missing published time on router descriptor"); goto err;
}
tor_assert(tok->n_args == 1);
if (parse_iso_time(tok->args[0], &router->cache_info.published_on) < 0)
@ -854,7 +854,7 @@ router_parse_entry_from_string(const char *s, const char *end,
/* If there's a fingerprint line, it must match the identity digest. */
char d[DIGEST_LEN];
if (tok->n_args < 1) {
log_warn(LD_DIR, "Too few arguments to fingerprint");
log_warn(LD_DIR, "Too few arguments to router fingerprint");
goto err;
}
tor_strstrip(tok->args[0], " ");
@ -1163,7 +1163,7 @@ networkstatus_parse_from_string(const char *s)
goto err;
}
if (tok->n_args < 1) {
log_warn(LD_DIR, "Too few arguments to fingerprint");
log_warn(LD_DIR, "Too few arguments to networkstatus fingerprint");
goto err;
}
if (base16_decode(ns->identity_digest, DIGEST_LEN, tok->args[0],
@ -1221,7 +1221,7 @@ networkstatus_parse_from_string(const char *s)
}
if (!(tok = find_first_by_keyword(tokens, K_PUBLISHED))) {
log_warn(LD_DIR, "Missing published time on directory.");
log_warn(LD_DIR, "Missing published time on network-status.");
goto err;
}
tor_assert(tok->n_args == 1);