How to capture "Received 16 file system events since last build" to an output file

At the end of a build, with fs-watch enabled, we get

> Task :ui_examples:assembleProdDebug UP-TO-DATE

112 actionable tasks: 112 up-to-date
Received 7 file system events during the current build while watching 1 hierarchies
Virtual file system retains information about 44838 files, 6420 directories and 67 missing files until next build

I’d like to capture the last two lines to an output file. Notably, this needs to be not from the command line.

Context: we’re capturing build times, and need to print out how many files changed per build.

I would expect this to work, but it doesn’t (from logging - Log to file with gradle 4 - Stack Overflow)

def fileLogger = [
        onOutput: {
            File logfile = new File("buildTimings.txt")
            logfile << it
] as org.gradle.api.logging.StandardOutputListener



gradle.taskGraph.whenReady { taskGraph ->
    taskGraph.allTasks.each { Task t ->
        t.doFirst {

does print out task timings, but I’m interested in the bit about file system events at the very end.

So far, I’ve not been able to figure out which “Listener” to use here, which exposes this information (I’ve tried all of them)

Has anyone ever been able to print this out? Thanks!