Pass logging a copy of the config to stop editing. Fixes #216

This commit is contained in:
Tulir Asokan
2018-09-01 14:07:44 +03:00
parent 6a1c160608
commit 29541ff520
+3 -2
View File
@@ -14,11 +14,12 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Coroutine, List, Optional from typing import Coroutine, List
import argparse import argparse
import asyncio import asyncio
import logging.config import logging.config
import sys import sys
import copy
from sqlalchemy import orm from sqlalchemy import orm
import sqlalchemy as sql import sqlalchemy as sql
@@ -66,7 +67,7 @@ if args.generate_registration:
print(f"Registration generated and saved to {config.registration_path}") print(f"Registration generated and saved to {config.registration_path}")
sys.exit(0) sys.exit(0)
logging.config.dictConfig(config["logging"]) logging.config.dictConfig(copy.deepcopy(config["logging"]))
log = logging.getLogger("mau.init") # type: logging.Logger log = logging.getLogger("mau.init") # type: logging.Logger
log.debug(f"Initializing mautrix-telegram {__version__}") log.debug(f"Initializing mautrix-telegram {__version__}")