Home / Function/ validateLogger() — fastify Function Reference

validateLogger() — fastify Function Reference

Architecture documentation for the validateLogger() function in logger-factory.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  95ccc80e_6854_d1b9_83d9_4d37bdbc7396["validateLogger()"]
  70c4c824_7f74_0fe8_3d46_0407aa0eeae5["logger-factory.js"]
  95ccc80e_6854_d1b9_83d9_4d37bdbc7396 -->|defined in| 70c4c824_7f74_0fe8_3d46_0407aa0eeae5
  e30adf1b_4bec_6ea1_35db_daf6add2b314["createChildLogger()"]
  e30adf1b_4bec_6ea1_35db_daf6add2b314 -->|calls| 95ccc80e_6854_d1b9_83d9_4d37bdbc7396
  56538483_b07d_ce58_e660_069d1d5aa7d1["createLogger()"]
  56538483_b07d_ce58_e660_069d1d5aa7d1 -->|calls| 95ccc80e_6854_d1b9_83d9_4d37bdbc7396
  style 95ccc80e_6854_d1b9_83d9_4d37bdbc7396 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/logger-factory.js lines 60–73

function validateLogger (logger, strict) {
  const methods = ['info', 'error', 'debug', 'fatal', 'warn', 'trace', 'child']
  const missingMethods = logger
    ? methods.filter(method => !logger[method] || typeof logger[method] !== 'function')
    : methods

  if (!missingMethods.length) {
    return true
  } else if ((missingMethods.length === methods.length) && !strict) {
    return false
  } else {
    throw FST_ERR_LOG_INVALID_LOGGER(missingMethods.join(','))
  }
}

Domain

Subdomains

Frequently Asked Questions

What does validateLogger() do?
validateLogger() is a function in the fastify codebase, defined in lib/logger-factory.js.
Where is validateLogger() defined?
validateLogger() is defined in lib/logger-factory.js at line 60.
What calls validateLogger()?
validateLogger() is called by 2 function(s): createChildLogger, createLogger.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free