• Get the logger to use in the current context.

    When given a request, if that request has a log property, then that logger is returned, otherwise the top-level logger instance is returned. This provides a convenience so that the calling code does not need to know the source of the logger.

    There is no need for things to knowingly request the top-level logger as things that are logging should not care. However, in a case where there is no request to use for context, it is equivalent to explicitly requesting the top-level logger.

    Type Parameters

    • TReq extends Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>, TReq> & {
          log?: Logger;
      }

    Parameters

    • Optional request: TReq

    Returns Logger

Generated using TypeDoc