mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-08 14:18:08 -05:00
config: Add a DebugEncryption setting to enable the nio crytpo logs.
This commit is contained in:
parent
b5ca82976c
commit
a51e93a868
@ -2,6 +2,7 @@
|
||||
LogLevel = Debug
|
||||
SSL = True
|
||||
Notifications = On
|
||||
DebugEncryption = True
|
||||
|
||||
[local-matrix]
|
||||
Homeserver = https://localhost:8448
|
||||
|
@ -38,6 +38,7 @@ class PanConfigParser(configparser.ConfigParser):
|
||||
"IndexEncryptedOnly": "True",
|
||||
"IndexingBatchSize": "100",
|
||||
"HistoryFetchDelay": "3000",
|
||||
"DebugEncryption": "False",
|
||||
},
|
||||
converters={
|
||||
"address": parse_address,
|
||||
@ -146,11 +147,14 @@ class PanConfig:
|
||||
config_path (str): The path where we should search for a configuration
|
||||
file.
|
||||
filename (str): The name of the file that we should read.
|
||||
debug_encryption (bool): Should debug logs be enabled for the Matrix
|
||||
encryption support.
|
||||
"""
|
||||
|
||||
config_file = attr.ib()
|
||||
|
||||
log_level = attr.ib(default=None)
|
||||
debug_encryption = attr.ib(type=bool, default=None)
|
||||
notifications = attr.ib(default=None)
|
||||
servers = attr.ib(init=False, default=attr.Factory(dict))
|
||||
|
||||
@ -172,6 +176,8 @@ class PanConfig:
|
||||
if self.notifications is None:
|
||||
self.notifications = config["Default"].getboolean("Notifications")
|
||||
|
||||
self.debug_encryption = config["Default"].getboolean("DebugEncryption")
|
||||
|
||||
listen_set = set()
|
||||
|
||||
try:
|
||||
|
@ -20,6 +20,8 @@ from typing import Optional
|
||||
import click
|
||||
import janus
|
||||
import keyring
|
||||
import logbook
|
||||
import nio
|
||||
from aiohttp import web
|
||||
from appdirs import user_config_dir, user_data_dir
|
||||
from logbook import StderrHandler
|
||||
@ -127,10 +129,11 @@ async def message_router(receive_queue, send_queue, proxies):
|
||||
type=click.Choice(["error", "warning", "info", "debug"]),
|
||||
default=None,
|
||||
)
|
||||
@click.option("--debug-encryption", is_flag=True)
|
||||
@click.option("-c", "--config", type=click.Path(exists=True))
|
||||
@click.option("--data-path", type=click.Path(exists=True))
|
||||
@click.pass_context
|
||||
def main(context, log_level, config, data_path):
|
||||
def main(context, log_level, debug_encryption, config, data_path):
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
conf_dir = user_config_dir("pantalaimon", "")
|
||||
@ -154,6 +157,10 @@ def main(context, log_level, config, data_path):
|
||||
context.fail("Homeserver is not configured.")
|
||||
|
||||
logger.level = pan_conf.log_level
|
||||
|
||||
if pan_conf.debug_encryption or debug_encryption:
|
||||
nio.crypto.logger.level = logbook.DEBUG
|
||||
|
||||
StderrHandler().push_application()
|
||||
|
||||
servers = []
|
||||
|
Loading…
Reference in New Issue
Block a user