Pretty printing function signature

I am looking for a way to print function signatures canonically in the compiler. def_path_str_with_substs almost does what I want, except that it does not print the local crate. DefPathBasedNames prints local crate but it doesn't print generics. Is there a way to make it print the local crate, or is there a better printer for this purpose? specifically I want it to print things like playground::main , and when a function has generics, it should also print the generic variables.