In the morning, I saw a friend curl a weather forecast HTTP resource on the shell terminal and found that the output text is colored, which inspired my interest in outputting colored text logs in the terminal to enhance readability.
The key point is to use Ctrl-v ctrl-[ to input a green ^[ under insert mode in vim, direct input ^[ is not working, the ASCII/UTF-8 encoding is 1B instead of 5E5B. 0A is new line
The PHP code is like this(Remember to use Ctrl-v ctrl-[ to input a green ^[ )
Cyan interface name, yellow request data and purple response data, readability is quite high compared to all white logs