mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +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:
@@ -8,16 +8,18 @@ from zerver.models import UserProfile, ScheduledEmail, get_user_profile_by_id, \
|
||||
|
||||
import datetime
|
||||
from email.utils import parseaddr, formataddr
|
||||
import logging
|
||||
import ujson
|
||||
|
||||
import os
|
||||
from typing import Any, Dict, Iterable, List, Mapping, Optional, Text
|
||||
|
||||
from zerver.lib.logging_util import create_logger
|
||||
from zerver.lib.logging_util import log_to_file
|
||||
|
||||
## Logging setup ##
|
||||
|
||||
logger = create_logger('zulip.send_email', settings.EMAIL_LOG_PATH)
|
||||
logger = logging.getLogger('zulip.send_email')
|
||||
log_to_file(logger, settings.EMAIL_LOG_PATH)
|
||||
|
||||
class FromAddress:
|
||||
SUPPORT = parseaddr(settings.ZULIP_ADMINISTRATOR)[1]
|
||||
|
||||
Reference in New Issue
Block a user