Skip to content

Commit

Permalink
fix: Log site only if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Aug 3, 2020
1 parent 9445c11 commit 4b93f75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions frappe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ def application(request):
frappe.monitor.stop(response)
frappe.recorder.dump()

_site = get_site_name(request.host)
frappe.logger("frappe.web", allow_site=_site).info({
"site": _site,
frappe.logger("frappe.web", allow_site=frappe.local.site).info({
"site": get_site_name(request.host),
"remote_addr": getattr(request, "remote_addr", "NOTFOUND"),
"base_url": getattr(request, "base_url", "NOTFOUND"),
"full_path": getattr(request, "full_path", "NOTFOUND"),
Expand Down
3 changes: 2 additions & 1 deletion frappe/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# imports - module imports
import frappe
from frappe.utils import get_sites


default_log_level = logging.DEBUG
Expand All @@ -33,7 +34,7 @@ def get_logger(module=None, with_more_info=False, allow_site=True, filter=None,

if allow_site is True:
site = getattr(frappe.local, "site", None)
elif allow_site:
elif allow_site in get_sites():
site = allow_site
else:
site = False
Expand Down

0 comments on commit 4b93f75

Please sign in to comment.