From 42e0b168e3d75389dfb968aebf9f5629d64782f9 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Mon, 21 Oct 2024 20:47:02 +0900 Subject: fmsg: produce all output through fmsg The behaviour of print functions from package fmt is not thread safe. Functions provided by fmsg wrap around Logger methods. This makes prefix much cleaner and makes it easy to deal with future changes to logging. Signed-off-by: Ophestra Umiker --- internal/environ.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'internal/environ.go') diff --git a/internal/environ.go b/internal/environ.go index 441c74ae..8f03cb34 100644 --- a/internal/environ.go +++ b/internal/environ.go @@ -1,13 +1,12 @@ package internal import ( - "fmt" "os" "path" "strconv" "sync" - "git.ophivana.moe/security/fortify/internal/verbose" + "git.ophivana.moe/security/fortify/internal/fmsg" ) // state that remain constant for the lifetime of the process @@ -37,16 +36,16 @@ func copySC() { SharePath: path.Join(os.TempDir(), "fortify."+strconv.Itoa(os.Geteuid())), } - verbose.Println("process share directory at", sc.SharePath) + fmsg.VPrintf("process share directory at %q", sc.SharePath) // runtimePath, runDirPath if r, ok := os.LookupEnv(xdgRuntimeDir); !ok { - fmt.Println("Env variable", xdgRuntimeDir, "unset") + fmsg.Println("variable", xdgRuntimeDir, "unset") os.Exit(1) } else { sc.RuntimePath = r sc.RunDirPath = path.Join(sc.RuntimePath, "fortify") - verbose.Println("XDG runtime directory at", sc.RunDirPath) + fmsg.VPrintf("XDG runtime directory at %q", sc.RunDirPath) } scVal = sc -- cgit v1.3.1