mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
logging: Reduce create_logger to new log_to_file.
The name `create_logger` suggests something much bigger than what this function actually does -- the logger doesn't any more or less exist after the function is called than before. Its one real function is to send logs to a specific file. So, pull out that logic to an appropriately-named function just for it. We already use `logging.getLogger` in a number of places to simply get a logger by name, and the old `create_logger` callsites can do the same.
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.utils import IntegrityError
|
||||
|
||||
from zerver.lib.logging_util import create_logger
|
||||
from zerver.lib.logging_util import log_to_file
|
||||
from zerver.models import UserProfile
|
||||
from zproject.backends import ZulipLDAPUserPopulator
|
||||
|
||||
## Setup ##
|
||||
logger = create_logger(__name__, settings.LDAP_SYNC_LOG_PATH)
|
||||
logger = logging.getLogger(__name__)
|
||||
log_to_file(logger, settings.LDAP_SYNC_LOG_PATH)
|
||||
|
||||
# Run this on a cronjob to pick up on name changes.
|
||||
def sync_ldap_user_data() -> None:
|
||||
|
||||
Reference in New Issue
Block a user