Skip to content

Fix global logging settings.#18

Merged
leeqvip merged 1 commit intocasbin:masterfrom
shblhy:master
Jul 4, 2019
Merged

Fix global logging settings.#18
leeqvip merged 1 commit intocasbin:masterfrom
shblhy:master

Conversation

@shblhy
Copy link
Contributor

@shblhy shblhy commented Jul 3, 2019

import casbin changed logging basic config, which is not excepted.

Fix: #17

@hsluoyz hsluoyz requested a review from leeqvip July 3, 2019 12:53
@shblhy shblhy force-pushed the master branch 2 times, most recently from fd45968 to 3af8c91 Compare July 3, 2019 15:28
@hsluoyz
Copy link
Member

hsluoyz commented Jul 3, 2019

Hi @shblhy , I see in 2nd commit, you have reverted back your change of 1st commit. You can just merge these 2 commits into one. So I can clearly see what has been changed in the whole PR.

"""sets the current logger."""
logger = l

logger.logger =l
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_logger should set the logger under the package, not the DefaultLogger.
This should refer to the Golang version of casbin.

fmt = "%(asctime)s - %(levelname)s - %(message)s"
formatter = logging.Formatter(fmt)
handler.setFormatter(formatter)
self.logger.addHandler(handler) No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to set_logger here.
In __init__, you can create a custom logger directly, so that it will not affect the global log configuration.

@shblhy shblhy force-pushed the master branch 3 times, most recently from 43cf227 to e6bb423 Compare July 4, 2019 03:03
@leeqvip leeqvip merged commit ee7c35f into casbin:master Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

casbin use global logging settings

3 participants