-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import logging | ||
|
||
from django.db import connection | ||
|
||
|
||
class TenantContextFilter(logging.Filter): | ||
""" | ||
Add the current ``schema_name`` and ``domain_url`` to log records. | ||
Thanks to @regolith for the snippet on https://github.com/bernardopires/django-tenant-schemas/issues/248 | ||
""" | ||
def filter(self, record): | ||
record.schema_name = connection.tenant.schema_name | ||
record.domain_url = getattr(connection.tenant, 'domain_url', '') | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this line raises an
AttributeError: can't set attribute
error