Added a parameter for newline character in the function trace->string