please include function print. static F1 interceptPrintInThisThread(F1 f) { F1 old = print_byThread()!; print_byThread().set(f); ret old; }