populate_db: Suppress logging output for push notifications.

This fixes a lot of spammy output of the form:

2018-11-27 17:46:48.279 INFO [zerver.lib.push_notifications] Sending push notification to user 46

when running populate_db, which is both confusing (since we're not
actually sending push notifications here) and spammy.
This commit is contained in:
Tim Abbott 2018-11-27 09:49:35 -08:00
parent 7b930124d9
commit 9c224ccdd3
1 changed files with 5 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import itertools import itertools
import mock
import os import os
import random import random
from typing import Any, Callable, Dict, Iterable, List, \ from typing import Any, Callable, Dict, Iterable, List, \
@ -19,6 +20,7 @@ from zerver.lib.bulk_create import bulk_create_streams, bulk_create_users
from zerver.lib.cache import cache_set from zerver.lib.cache import cache_set
from zerver.lib.generate_test_data import create_test_data from zerver.lib.generate_test_data import create_test_data
from zerver.lib.onboarding import create_if_missing_realm_internal_bots from zerver.lib.onboarding import create_if_missing_realm_internal_bots
from zerver.lib.push_notifications import logger as push_notifications_logger
from zerver.lib.upload import upload_backend from zerver.lib.upload import upload_backend
from zerver.lib.users import add_service from zerver.lib.users import add_service
from zerver.lib.url_preview.preview import CACHE_NAME as PREVIEW_CACHE_NAME from zerver.lib.url_preview.preview import CACHE_NAME as PREVIEW_CACHE_NAME
@ -38,6 +40,9 @@ settings.CACHES['default'] = {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
} }
# Suppress spammy output from the push notifications logger
push_notifications_logger.disabled = True
def create_users(realm: Realm, name_list: Iterable[Tuple[str, str]], def create_users(realm: Realm, name_list: Iterable[Tuple[str, str]],
bot_type: Optional[int]=None, bot_type: Optional[int]=None,
bot_owner: Optional[UserProfile]=None) -> None: bot_owner: Optional[UserProfile]=None) -> None: