Core
Framework v2.x
2

child() #

Creates a child logger. Its namespace is appended to the parent's one (kuzzle:app:<namespace> for a child of app.log).

The child writes to the same transports as its parent and follows the parent's level until its own level is set.

child(namespace: string): Logger

ArgumentTypeDescription
namespace
string
Namespace of the child logger

Return #

A child Logger, with every method of its parent, getLevel, setLevel, silly and verbose included.

Before 2.60.0, a child lacked getLevel, setLevel, silly and verbose, although it was declared as a Logger.

Usage #

const mailerLog = app.log.child('mailer');

mailerLog.info('Mail sent'); // namespace: "kuzzle:app:mailer"