From: Andrew Lewis Date: Thu, 17 Nov 2016 10:46:02 +0000 (+0200) Subject: [Minor] Use new logging API everywhere X-Git-Tag: 1.4.0~41^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1146%2Fhead;p=rspamd.git [Minor] Use new logging API everywhere --- diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua index 9cb109fbf..e3945842c 100644 --- a/src/plugins/lua/asn.lua +++ b/src/plugins/lua/asn.lua @@ -86,7 +86,7 @@ local function asn_check(task) redis_key, tostring(options['expire']) }) else - rspamd_logger.err(task, 'got error while connecting to redis') + rspamd_logger.errx(task, 'got error while connecting to redis') end end end @@ -122,7 +122,7 @@ local function asn_check(task) {key, tostring(options.expire)} -- arguments ) if not ret then - rspamd_logger.err('got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end end end diff --git a/src/plugins/lua/fann_classifier.lua b/src/plugins/lua/fann_classifier.lua index 94261839b..c4110981d 100644 --- a/src/plugins/lua/fann_classifier.lua +++ b/src/plugins/lua/fann_classifier.lua @@ -89,7 +89,7 @@ local function maybe_load_fann(task, continue_cb, call_if_fail) {key, 'version', 'data', 'spam', 'ham'} -- arguments ) if not ret then - rspamd_logger.err(task, 'got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end end @@ -120,7 +120,7 @@ local function maybe_load_fann(task, continue_cb, call_if_fail) {key, 'version'} -- arguments ) if not ret then - rspamd_logger.err(task, 'got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end end @@ -218,7 +218,7 @@ local function save_fann(task, is_spam) conn:add_cmd('HINCRBY', {key, 'ham', 1}) end else - rspamd_logger.err(task, 'got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end end diff --git a/src/plugins/lua/fann_redis.lua b/src/plugins/lua/fann_redis.lua index cc24051d0..fffb5dcd9 100644 --- a/src/plugins/lua/fann_redis.lua +++ b/src/plugins/lua/fann_redis.lua @@ -326,7 +326,7 @@ local function load_or_invalidate_fann(data, id, ev_base) if _err then rspamd_logger.errx(rspamd_config, 'cannot invalidate ANN %s from redis: %s', id, _err) elseif type(_data) == 'string' then - rspamd_logger.info(rspamd_config, 'invalidated ANN %s from redis: %s', id, _err) + rspamd_logger.infox(rspamd_config, 'invalidated ANN %s from redis: %s', id, _err) fanns[id].version = 0 end end diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index 7a84e46f3..3d946fcf5 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -221,7 +221,7 @@ local function greylist_check(task) {body_key, meta_key} -- arguments ) if not ret then - rspamd_logger.err(task, 'cannot make redis request to check results') + rspamd_logger.errx(task, 'cannot make redis request to check results') end end @@ -296,7 +296,7 @@ local function greylist_set(task) meta_key, tostring(settings['expire']) }) else - rspamd_logger.err(task, 'got error while connecting to redis') + rspamd_logger.errx(task, 'got error while connecting to redis') end elseif do_greylisting or do_greylisting_required then local t = tostring(math.floor(rspamd_util.get_time())) @@ -320,7 +320,7 @@ local function greylist_set(task) meta_key, tostring(settings['expire']), t }) else - rspamd_logger.err(task, 'got error while connecting to redis') + rspamd_logger.errx(task, 'got error while connecting to redis') end else if action ~= 'no action' and action ~= 'reject' then diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index 205fc9627..b894cfbe0 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -166,7 +166,7 @@ local ip_score_set = function(task) redis_args -- arguments ) if not ret then - rspamd_logger.err(task, 'error connecting to redis') + rspamd_logger.errx(task, 'error connecting to redis') return end @@ -319,7 +319,7 @@ local ip_score_check = function(task) args -- arguments ) if not ret then - rspamd_logger.err(task, 'error connecting to redis') + rspamd_logger.errx(task, 'error connecting to redis') end end end diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index e95478b48..6c77714a9 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -90,7 +90,7 @@ local function metadata_exporter(task) {channel, data} -- arguments ) if not ret then - rspamd_logger.err(task, 'error connecting to redis') + rspamd_logger.errx(task, 'error connecting to redis') end end if url then diff --git a/src/plugins/lua/metric_exporter.lua b/src/plugins/lua/metric_exporter.lua index 85cace8ea..9608fb83f 100644 --- a/src/plugins/lua/metric_exporter.lua +++ b/src/plugins/lua/metric_exporter.lua @@ -53,7 +53,7 @@ local valid_metrics = { local function validate_metrics(settings_metrics) if type(settings_metrics) ~= 'table' or #settings_metrics == 0 then - logger.err('No metrics specified for collection') + logger.errx(rspamd_config, 'No metrics specified for collection') return false end for _, v in ipairs(settings_metrics) do @@ -144,7 +144,7 @@ local backends = { local function configure_metric_exporter() local opts = rspamd_config:get_all_opt('metric_exporter') if not backends[opts['backend']] then - logger.err('Backend is invalid or unspecified') + logger.errx(rspamd_config, 'Backend is invalid or unspecified') return false end for k, v in pairs(opts) do diff --git a/src/plugins/lua/mx_check.lua b/src/plugins/lua/mx_check.lua index c81fd0dd6..ca966909c 100644 --- a/src/plugins/lua/mx_check.lua +++ b/src/plugins/lua/mx_check.lua @@ -86,7 +86,7 @@ local function mx_check(task) {key, tostring(settings.expire_novalid), '0'} -- arguments ) if not ret then - rspamd_logger.err(task, 'got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end else local valid_mx = {} @@ -103,7 +103,7 @@ local function mx_check(task) {key, tostring(settings.expire), table.concat(valid_mx, ';')} -- arguments ) if not ret then - rspamd_logger.err(task, 'error connecting to redis') + rspamd_logger.errx(task, 'error connecting to redis') end end end diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index 1a7bdf222..a05ebc2e9 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -304,7 +304,7 @@ local function check_limits(task, args) fun.totable(fun.map(function(l) return l[2] end, args)) -- arguments ) if not ret then - rspamd_logger.err(task, 'got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end end @@ -370,7 +370,7 @@ local function set_limits(task, args) conn:add_cmd('setex', v) end, fun.drop_n(1, values)) else - rspamd_logger.err(task, 'got error while connecting to redis') + rspamd_logger.errx(task, 'got error while connecting to redis') end end end @@ -385,7 +385,7 @@ local function set_limits(task, args) fun.totable(fun.map(function(l) return l[2] end, args)) -- arguments ) if not ret then - rspamd_logger.err(task, 'got error connecting to redis') + rspamd_logger.errx(task, 'got error connecting to redis') end end