Applying a method to compact the trace log

Signed-off-by: Herbert <herberthb12@gmail.com>