Home / Function/ createChildLogger() — fastify Function Reference

createChildLogger() — fastify Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

lib/logger-factory.js lines 22–34

function createChildLogger (context, logger, req, reqId, loggerOpts) {
  const loggerBindings = {
    [context.requestIdLogLabel]: reqId
  }
  const child = context.childLoggerFactory.call(context.server, logger, loggerBindings, loggerOpts || {}, req)

  // Optimization: bypass validation if the factory is our own default factory
  if (context.childLoggerFactory !== defaultChildLoggerFactory) {
    validateLogger(child, true) // throw if the child is not a valid logger
  }

  return child
}

Domain

Subdomains

Frequently Asked Questions

What does createChildLogger() do?
createChildLogger() is a function in the fastify codebase, defined in lib/logger-factory.js.
Where is createChildLogger() defined?
createChildLogger() is defined in lib/logger-factory.js at line 22.
What does createChildLogger() call?
createChildLogger() calls 1 function(s): validateLogger.

Analyze Your Own Codebase

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

Try Supermodel Free