aboutsummaryrefslogtreecommitdiffhomepage
path: root/config.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-21 20:47:02 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-21 20:47:02 +0900
commit42e0b168e3d75389dfb968aebf9f5629d64782f9 (patch)
treee6b430205213c62bc06275c6d84e6037d40f5c3f /config.go
parent380d1f45851b7dffb963c51da96a17ba41f3cfb8 (diff)
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 <cat@ophivana.moe>
Diffstat (limited to 'config.go')
-rw-r--r--config.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/config.go b/config.go
index 228d3feb..26510e40 100644
--- a/config.go
+++ b/config.go
@@ -9,6 +9,7 @@ import (
"git.ophivana.moe/security/fortify/dbus"
"git.ophivana.moe/security/fortify/internal"
"git.ophivana.moe/security/fortify/internal/app"
+ "git.ophivana.moe/security/fortify/internal/fmsg"
"git.ophivana.moe/security/fortify/internal/system"
)
@@ -60,7 +61,7 @@ func init() {
func tryTemplate() {
if printTemplate {
if s, err := json.MarshalIndent(app.Template(), "", " "); err != nil {
- fatalf("cannot generate template: %v", err)
+ fmsg.Fatalf("cannot generate template: %v", err)
panic("unreachable")
} else {
fmt.Println(string(s))
@@ -77,10 +78,10 @@ func loadConfig() *app.Config {
// config from file
c := new(app.Config)
if f, err := os.Open(confPath); err != nil {
- fatalf("cannot access config file '%s': %s\n", confPath, err)
+ fmsg.Fatalf("cannot access config file %q: %s", confPath, err)
panic("unreachable")
} else if err = json.NewDecoder(f).Decode(&c); err != nil {
- fatalf("cannot parse config file '%s': %s\n", confPath, err)
+ fmsg.Fatalf("cannot parse config file %q: %s", confPath, err)
panic("unreachable")
} else {
return c
@@ -110,7 +111,7 @@ func configFromFlags() (config *app.Config) {
config.Confinement.SessionBus = dbus.NewConfig(dbusID, true, mpris)
} else {
if c, err := dbus.NewConfigFromFile(dbusConfigSession); err != nil {
- fatalf("cannot load session bus proxy config from %q: %s\n", dbusConfigSession, err)
+ fmsg.Fatalf("cannot load session bus proxy config from %q: %s", dbusConfigSession, err)
} else {
config.Confinement.SessionBus = c
}
@@ -119,7 +120,7 @@ func configFromFlags() (config *app.Config) {
// system bus proxy is optional
if dbusConfigSystem != "nil" {
if c, err := dbus.NewConfigFromFile(dbusConfigSystem); err != nil {
- fatalf("cannot load system bus proxy config from %q: %s\n", dbusConfigSystem, err)
+ fmsg.Fatalf("cannot load system bus proxy config from %q: %s", dbusConfigSystem, err)
} else {
config.Confinement.SystemBus = c
}