Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use named loggers #153

Merged
merged 1 commit into from
May 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion casbin/core_enforcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CoreEnforcer:
auto_build_role_links = False

def __init__(self, model=None, adapter=None):
self.logger = logging.getLogger()
self.logger = logging.getLogger(__name__)
if isinstance(model, str):
if isinstance(adapter, str):
self.init_with_file(model, adapter)
Expand Down Expand Up @@ -59,6 +59,7 @@ def init_with_model_and_adapter(self, m, adapter=None):
self.adapter = adapter

self.model = m
m.logger = self.logger
self.model.print_model()
self.fm = FunctionMap.load_function_map()

Expand Down
2 changes: 1 addition & 1 deletion casbin/distributed_enforcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DistributedEnforcer(SyncedEnforcer):
"""DistributedEnforcer wraps SyncedEnforcer for dispatcher."""

def __init__(self, model=None, adapter=None):
self.logger = logging.getLogger()
self.logger = logging.getLogger(__name__)
SyncedEnforcer.__init__(self, model, adapter)

def add_policy_self(self, should_persist, sec, ptype, rules):
Expand Down
2 changes: 1 addition & 1 deletion casbin/model/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Assertion:
def __init__(self):
self.logger = logging.getLogger()
self.logger = logging.getLogger(__name__)
self.key = ""
self.value = ""
self.tokens = []
Expand Down
2 changes: 1 addition & 1 deletion casbin/model/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Policy:
def __init__(self):
self.logger = logging.getLogger()
self.logger = logging.getLogger(__name__)
self.model = {}

def build_role_links(self, rm_map):
Expand Down
2 changes: 1 addition & 1 deletion casbin/rbac/default_role_manager/role_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class RoleManager(RoleManager):
max_hierarchy_level = 0

def __init__(self, max_hierarchy_level):
self.logger = logging.getLogger()
self.logger = logging.getLogger(__name__)
self.all_roles = dict()
self.max_hierarchy_level = max_hierarchy_level
self.matching_func = None
Expand Down