summaryrefslogtreecommitdiffstats
path: root/matterbridge.go
diff options
context:
space:
mode:
Diffstat (limited to 'matterbridge.go')
-rw-r--r--matterbridge.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/matterbridge.go b/matterbridge.go
index 7b04182d..63fd12f7 100644
--- a/matterbridge.go
+++ b/matterbridge.go
@@ -51,6 +51,15 @@ func main() {
cfg := config.NewConfig(rootLogger, *flagConfig)
cfg.BridgeValues().General.Debug = *flagDebug
+ // if logging to a file, ensure it is closed when the program terminates
+ // nolint:errcheck
+ defer func() {
+ if f, ok := rootLogger.Out.(*os.File); ok {
+ f.Sync()
+ f.Close()
+ }
+ }()
+
r, err := gateway.NewRouter(rootLogger, cfg, bridgemap.FullMap)
if err != nil {
logger.Fatalf("Starting gateway failed: %s", err)