query
On this page

trace

lib.sources.trace

Docs pulled from | This Revision | 16 minutes ago


Add logging to a source, for troubleshooting the filtering behavior.

Inputs

src

Source to debug. The returned source will behave like this source, but also log its filter invocations.

Type

sources.trace :: sourceLike -> Source

Noogle detected

Implementation

The following is the current implementation of this function.

trace =
    # Source to debug. The returned source will behave like this source, but also log its filter invocations.
    src:
    let
      attrs = toSourceAttributes src;
    in
    fromSourceAttributes (
      attrs
      // {
        filter =
          path: type:
          let
            r = attrs.filter path type;
          in
          builtins.trace "${attrs.name}.filter ${path} = ${boolToString r}" r;
      }
    )
    // {
      satisfiesSubpathInvariant = src ? satisfiesSubpathInvariant && src.satisfiesSubpathInvariant;
    };