fix(app/metrics): debug logs for sub-functions [skip ci]

This commit is contained in:
lowlighter
2022-01-25 21:33:12 -05:00
parent f16bc09f05
commit 2096473939

View File

@@ -104,7 +104,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
meta.inputs = function({data:{user = null} = {}, q, account}, defaults = {}) { meta.inputs = function({data:{user = null} = {}, q, account}, defaults = {}) {
//Support check //Support check
if (!account) if (!account)
logger(`metrics/inputs > account type not set for plugin ${name}!`) console.debug(`metrics/inputs > account type not set for plugin ${name}!`)
if (account !== "bypass") { if (account !== "bypass") {
const context = q.repo ? "repository" : account const context = q.repo ? "repository" : account
if (!meta.supports?.includes(context)) if (!meta.supports?.includes(context))
@@ -242,25 +242,26 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
let value let value
//From presets //From presets
if ((key in preset)&&(unspecified)) { if ((key in preset)&&(unspecified)) {
logger(`metrics/inputs > ${key} has been set by preset value`) console.debug(`metrics/inputs > ${key} has been set by preset value`)
q[key] = preset[key] q[key] = preset[key]
continue continue
} }
//From defaults //From defaults
else if (unspecified) { else if (unspecified) {
logger(`metrics/inputs > ${key} has been set by default value`) console.debug(`metrics/inputs > ${key} has been set by default value`)
value = metadata.inputs[key]?.default value = metadata.inputs[key]?.default
} }
//From user //From user
else { else {
logger(`metrics/inputs > ${key} has been set by user`) console.debug(`metrics/inputs > ${key} has been set by user`)
value = `${core.getInput(key)}`.trim() value = `${core.getInput(key)}`.trim()
} }
try { try {
q[key] = decodeURIComponent(value) q[key] = decodeURIComponent(value)
} }
catch { catch {
logger(`metrics/inputs > failed to decode uri : ${value}`) console.debug(`metrics/inputs > failed to decode uri for ${key}`)
logger(`metrics/inputs > failed to decode uri for ${key}: ${value}`)
q[key] = value q[key] = value
} }
} }
@@ -420,8 +421,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
return meta return meta
} }
catch (error) { catch (error) {
console.warn(error) console.debug(`metrics/metadata > failed to load plugin ${name}: ${error}`)
logger(`metrics/metadata > failed to load plugin ${name}: ${error}`)
return null return null
} }
} }
@@ -510,7 +510,7 @@ metadata.template = async function({__templates, name, plugins, logger}) {
} }
} }
catch (error) { catch (error) {
logger(`metrics/metadata > failed to load template ${name}: ${error}`) console.debug(`metrics/metadata > failed to load template ${name}: ${error}`)
return null return null
} }
} }