diff options
author | Lukáš Ježek <lukas.jezek@nic.cz> | 2021-06-18 10:14:56 +0200 |
---|---|---|
committer | Tomas Krizek <tomas.krizek@nic.cz> | 2021-07-29 11:40:50 +0200 |
commit | 940c12580cf0b8b9fe45491c7dfabc8f971c8548 (patch) | |
tree | 6208aa672366d9ba52b26377e4827fbe5a10fd55 /lib/cache | |
parent | log: add level prefix to each message (diff) | |
download | knot-resolver-940c12580cf0b8b9fe45491c7dfabc8f971c8548.tar.xz knot-resolver-940c12580cf0b8b9fe45491c7dfabc8f971c8548.zip |
log: remove hard-coded prefix from log messages
Diffstat (limited to 'lib/cache')
-rw-r--r-- | lib/cache/api.c | 6 | ||||
-rw-r--r-- | lib/cache/cdb_lmdb.c | 20 | ||||
-rw-r--r-- | lib/cache/entry_list.c | 4 | ||||
-rw-r--r-- | lib/cache/entry_rr.c | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/lib/cache/api.c b/lib/cache/api.c index ad7606f8..583c6121 100644 --- a/lib/cache/api.c +++ b/lib/cache/api.c @@ -81,7 +81,7 @@ static int assert_right_version(struct kr_cache *cache) * Recreate cache and write version key. */ ret = cache_op(cache, count); if (ret != 0) { /* Log for non-empty cache to limit noise on fresh start. */ - kr_log_info(LOG_GRP_CACHE, "[cache] incompatible cache database detected, purging\n"); + kr_log_info(LOG_GRP_CACHE, "incompatible cache database detected, purging\n"); if (oldret) { kr_log_verbose("[cache] reading version returned: %d\n", oldret); } else if (val.len != sizeof(CACHE_VERSION)) { @@ -143,7 +143,7 @@ int kr_cache_open(struct kr_cache *cache, const struct kr_cdb_api *api, struct k if (ret == 0 && opts->maxsize) { size_t maxsize = cache->api->get_maxsize(cache->db); if (maxsize > opts->maxsize) kr_log_warning(LOG_GRP_CACHE, - "[cache] Warning: real cache size is %zu instead of the requested %zu bytes." + "Warning: real cache size is %zu instead of the requested %zu bytes." " To reduce the size you need to remove the file '%s' by hand.\n", maxsize, opts->maxsize, fpath); } @@ -690,7 +690,7 @@ static int stash_rrarray_entry(ranked_rr_array_t *arr, int arr_i, ssize_t written = stash_rrset(cache, qry, rr, rr_sigs, qry->timestamp.tv_sec, entry->rank, nsec_pmap, needs_pkt); if (written < 0) { - kr_log_error(LOG_GRP_CACHE, "[%05u.%02u][cach] stash failed, ret = %d\n", qry->request->uid, + kr_log_error(LOG_GRP_CACHE, "[%05u.%02u] stash failed, ret = %d\n", qry->request->uid, qry->uid, ret); return (int) written; } diff --git a/lib/cache/cdb_lmdb.c b/lib/cache/cdb_lmdb.c index b9a4f62a..3d93ded5 100644 --- a/lib/cache/cdb_lmdb.c +++ b/lib/cache/cdb_lmdb.c @@ -87,7 +87,7 @@ static int lmdb_error(int error) case MDB_TXN_FULL: return kr_error(ENOSPC); default: - kr_log_error(LOG_GRP_CACHE, "[cache] LMDB error: %s\n", mdb_strerror(error)); + kr_log_error(LOG_GRP_CACHE, "LMDB error: %s\n", mdb_strerror(error)); return kr_error(error); } } @@ -116,7 +116,7 @@ static int refresh_mapsize(struct lmdb_env *env) env->mapsize = info.me_mapsize; if (env->mapsize != env->st_size) { - kr_log_info(LOG_GRP_CACHE, "[cache] suspicious size of cache file '%s'" + kr_log_info(LOG_GRP_CACHE, "suspicious size of cache file '%s'" ": file size %zu != LMDB map size %zu\n", env->mdb_data_path, (size_t)env->st_size, env->mapsize); } @@ -128,10 +128,10 @@ static void clear_stale_readers(struct lmdb_env *env) int cleared; int ret = mdb_reader_check(env->env, &cleared); if (ret != MDB_SUCCESS) { - kr_log_error(LOG_GRP_CACHE, "[cache] failed to clear stale reader locks: " + kr_log_error(LOG_GRP_CACHE, "failed to clear stale reader locks: " "LMDB error %d %s\n", ret, mdb_strerror(ret)); } else if (cleared != 0) { - kr_log_info(LOG_GRP_CACHE, "[cache] cleared %d stale reader locks\n", cleared); + kr_log_info(LOG_GRP_CACHE, "cleared %d stale reader locks\n", cleared); } } @@ -160,7 +160,7 @@ retry: } if (unlikely(ret == MDB_MAP_RESIZED)) { - kr_log_info(LOG_GRP_CACHE, "[cache] detected size increased by another process\n"); + kr_log_info(LOG_GRP_CACHE, "detected size increased by another process\n"); ret = refresh_mapsize(env); if (ret == 0) goto retry; @@ -384,7 +384,7 @@ static int cdb_open_env(struct lmdb_env *env, const char *path, const size_t map if (ret == EINVAL) { /* POSIX says this can happen when the feature isn't supported by the FS. * We haven't seen this happen on Linux+glibc but it was reported on FreeBSD.*/ - kr_log_info(LOG_GRP_CACHE, "[cache] space pre-allocation failed and ignored; " + kr_log_info(LOG_GRP_CACHE, "space pre-allocation failed and ignored; " "your (file)system probably doesn't support it.\n"); } else if (ret != 0) { mdb_txn_abort(txn); @@ -495,7 +495,7 @@ static int cdb_check_health(kr_cdb_pt db, struct kr_cdb_stats *stats) * contrary to methods based on mdb_env_info(). */ if (st.st_size == env->st_size) return kr_ok(); - kr_log_info(LOG_GRP_CACHE, "[cache] detected size change (by another instance?) of file '%s'" + kr_log_info(LOG_GRP_CACHE, "detected size change (by another instance?) of file '%s'" ": file size %zu -> file size %zu\n", env->mdb_data_path, (size_t)env->st_size, (size_t)st.st_size); env->st_size = st.st_size; // avoid retrying in cycle even if we fail @@ -558,7 +558,7 @@ static int cdb_clear(kr_cdb_pt db, struct kr_cdb_stats *stats) return ret; } } - kr_log_info(LOG_GRP_CACHE, "[cache] clearing error, falling back\n"); + kr_log_info(LOG_GRP_CACHE, "clearing error, falling back\n"); } /* Fallback: we'll remove the database files and reopen. * Other instances can continue to use the removed lmdb, @@ -582,7 +582,7 @@ static int cdb_clear(kr_cdb_pt db, struct kr_cdb_stats *stats) /* Find if we get a lock on lockfile. */ const int lockfile_fd = lockfile_get(lockfile); if (lockfile_fd < 0) { - kr_log_error(LOG_GRP_CACHE, "[cache] clearing failed to get ./krcachelock (%s); retry later\n", + kr_log_error(LOG_GRP_CACHE, "clearing failed to get ./krcachelock (%s); retry later\n", kr_strerror(lockfile_fd)); /* As we're out of space (almost certainly - mdb_drop didn't work), * we will retry on the next failing write operation. */ @@ -608,7 +608,7 @@ static int cdb_clear(kr_cdb_pt db, struct kr_cdb_stats *stats) /* Environment updated, release lockfile. */ int lrerr = lockfile_release(lockfile_fd); if (lrerr) { - kr_log_error(LOG_GRP_CACHE, "[cache] failed to release ./krcachelock: %s\n", + kr_log_error(LOG_GRP_CACHE, "failed to release ./krcachelock: %s\n", kr_strerror(lrerr)); } return ret; diff --git a/lib/cache/entry_list.c b/lib/cache/entry_list.c index fb6c457c..5276d5a5 100644 --- a/lib/cache/entry_list.c +++ b/lib/cache/entry_list.c @@ -185,7 +185,7 @@ static int cache_write_or_clear(struct kr_cache *cache, const knot_db_val_t *key */ const uint64_t now = kr_now(); if (!ignoring_errors_until) { // First error after a success. - kr_log_info(LOG_GRP_CACHE, "[cache] LMDB refusing writes (ignored for 5-9s): %s\n", + kr_log_info(LOG_GRP_CACHE, "LMDB refusing writes (ignored for 5-9s): %s\n", kr_strerror(ret)); ignoring_errors_until = now + 5000 + kr_rand_bytes(2)/16; return kr_error(ret); @@ -202,7 +202,7 @@ recovery: // Try to recover by clearing cache. kr_strerror(ret)); abort(); case 0: - kr_log_info(LOG_GRP_CACHE, "[cache] stuck cache cleared\n"); + kr_log_info(LOG_GRP_CACHE, "stuck cache cleared\n"); ignoring_errors_until = 0; case -EAGAIN: // fall-through; krcachelock race -> retry later return kr_error(ENOSPC); diff --git a/lib/cache/entry_rr.c b/lib/cache/entry_rr.c index 06997264..a16eff5a 100644 --- a/lib/cache/entry_rr.c +++ b/lib/cache/entry_rr.c @@ -98,7 +98,7 @@ int entry2answer(struct answer *ans, int id, /* Sanity check: we consumed exactly all data. */ int unused_bytes = eh_bound - (uint8_t *)eh->data - data_off - ret; if (kr_fails_assert(unused_bytes == 0)) { - kr_log_error(LOG_GRP_CACHE, "[cach] entry2answer ERROR: unused bytes: %d\n", + kr_log_error(LOG_GRP_CACHE, "entry2answer ERROR: unused bytes: %d\n", unused_bytes); ret = kr_error(EILSEQ); goto fail; /* to be on the safe side */ |