Update matrix logging and federation config

- The logging before was unusably verbose
- The extra fedearation is unlikely to put much burden on our server, but it
  should improve the experience for our friends on other servers

Change-Id: I71aab738d75bae43a58a9a412d021ab909c66339
diff --git a/modules/matrix.nix b/modules/matrix.nix
index d3d46f5..7441390 100644
--- a/modules/matrix.nix
+++ b/modules/matrix.nix
@@ -14,6 +14,8 @@
       auto_join_rooms = [ "#general:${server_name}" ];
       enable_registration = true;
       registration_requires_token = true;
+      allow_public_rooms_over_federation = true;
+      allow_device_name_lookup_over_federation = true;
       registration_shared_secret = "!!registration_shared_secret!!";
       public_baseurl = "https://matrix-backend.coded.codes/";
       max_upload_size = "100M";
@@ -39,6 +41,31 @@
         "turns:turn.coded.codes:5349?transport=tcp" */
       ]; # Please use matrix.org turn
       # turn_shared_secret = "!!turn_shared_secret!!";
+
+      log_config = lib.pipe {
+        version = 1;
+        formatters = {
+          precise = {
+            format =
+              "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s";
+          };
+        };
+        handlers = {
+          console = {
+            class = "logging.StreamHandler";
+            formatter = "precise";
+          };
+        };
+        loggers = { "synapse.storage.SQL" = { level = "WARNING"; }; };
+        root = {
+          level = "ERROR";
+          handlers = [ "console" ];
+        };
+        "disable_existing_loggers" = false;
+      } [
+        builtins.toJSON
+        (builtins.toFile "logcfg.yaml")
+      ];
     };
   };