mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 19:43:47 +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:
@@ -31,7 +31,7 @@ from io import BytesIO
|
||||
import urllib
|
||||
|
||||
from typing import Union, Any, Callable, Sequence, Dict, Optional, TypeVar, Text, Tuple, cast
|
||||
from zerver.lib.logging_util import create_logger
|
||||
from zerver.lib.logging_util import log_to_file
|
||||
|
||||
# This is a hack to ensure that RemoteZulipServer always exists even
|
||||
# if Zilencer isn't enabled.
|
||||
@@ -45,8 +45,8 @@ else:
|
||||
ViewFuncT = TypeVar('ViewFuncT', bound=Callable[..., HttpResponse])
|
||||
ReturnT = TypeVar('ReturnT')
|
||||
|
||||
## logger setup
|
||||
webhook_logger = create_logger("zulip.zerver.webhooks", settings.API_KEY_ONLY_WEBHOOK_LOG_PATH)
|
||||
webhook_logger = logging.getLogger("zulip.zerver.webhooks")
|
||||
log_to_file(webhook_logger, settings.API_KEY_ONLY_WEBHOOK_LOG_PATH)
|
||||
|
||||
class _RespondAsynchronously:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user