NordSecurity / nordvpn-linux

NordVPN Linux client
GNU General Public License v3.0
287 stars 44 forks source link

Log improvement proposal #481

Open devzbysiu opened 2 days ago

devzbysiu commented 2 days ago

This is a proposal for logging improvement. Currently, we have slight inconsistencies with lines like this:

log.Printf("%s Setting notifications %s error: %s", internal.ErrorPrefix, flagText, err) // prefix formatted in
log.Printf(internal.ErrorPrefix+" Setting notifications %s error: %s", flagText, err) // prefix prepended to the format str
log.Printf("Setting notifications %s error: %s", flagText, err) // no prefix
log.Printf("Setting notifications %s error: %s", flagText, err) // no new line at the end
log.Printf("Setting notifications") // no formatting
log.Prinln("Setting notifications error: ", err) // redundant space after "error:"

This PR introduces logging functions which take care of the log prefix. The next step will be to migrate the codebase and fix inconsistencies.