Removing unnecessary newline strings on log commands (\n and \r\n).
Converting logging from string concatenation (.Info) to formatter logs (.Infof)
Adding whitespace to crowded log lines
Console example
Logging example to console before
INFO[0000] GoDNS started, entering main loop...
INFO[0000] Creating DNS handler with provider:Cloudflare
INFO[0000] Checking IP for domain domain.com
INFO[0003] Querying records with type:A
NFO[0003] Record OK: vpn.domain.com - 0.0.0.0
Notice the missing I at INFO on last line and the crowded provider:Cloudflare and type:A log lines.
After
INFO[0000] GoDNS started, entering main loop...
INFO[0000] Creating DNS handler with provider: Cloudflare
INFO[0000] Checking IP for domain domain.com
INFO[0001] Querying records with type: A
INFO[0001] Record OK: vpn.domain.com - 0.0.0.0
File log example
Log redirected to file before
time="2022-03-26T10:20:01+11:00" level=info msg="GoDNS started, entering main loop..."
time="2022-03-26T10:20:01+11:00" level=info msg="Creating DNS handler with provider:Cloudflare"
time="2022-03-26T10:20:02+11:00" level=info msg="Checking IP for domain domain.com"
time="2022-03-26T10:20:06+11:00" level=info msg="Querying records with type:A"
time="2022-03-26T10:20:08+11:00" level=info msg="Record OK: vpn.domain.com - 0.0.0.0\r\n"
Notice the invalid \r\n at the end of the log line
After
time="2022-03-26T10:59:24+11:00" level=info msg="GoDNS started, entering main loop..."
time="2022-03-26T10:59:24+11:00" level=info msg="Creating DNS handler with provider: Cloudflare"
time="2022-03-26T10:59:25+11:00" level=info msg="Checking IP for domain domain.com"
time="2022-03-26T10:59:26+11:00" level=info msg="Querying records with type: A"
time="2022-03-26T10:59:26+11:00" level=info msg="Record OK: vpn.domain.com - 0.0.0.0"
\n
and\r\n
)..Info
) to formatter logs (.Infof
)Console example
Logging example to console before
Notice the missing
I
at INFO on last line and the crowdedprovider:Cloudflare
andtype:A
log lines.After
File log example
Log redirected to file before
Notice the invalid
\r\n
at the end of the log lineAfter