amenezes / config-client

config-client package for spring cloud config and cloud foundry
https://config-client.amenezes.net/
Apache License 2.0
24 stars 17 forks source link

Change logging to logger #31

Closed luiscoms closed 4 years ago

luiscoms commented 4 years ago

In order to log on config module instead of root logger, This pull request replace logging by logger

amenezes commented 4 years ago

@luiscoms,

Could you put the code snippet below in config/__init__.py file and change the calls for the logger?

# config/__init__.py
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
# For example: config/auth.py
# but all files that use logging must be changed to logger

# from
logging.info("Access token successfully obtained.")
# to
logger.info("Access token successfully obtained.")
luiscoms commented 4 years ago

Hi @amenezes,

I did the update, but change this cause that logger name is always 'config', not 'config.spring'

amenezes commented 4 years ago

Yes. It's because of the name of the __name__ module. It is useful if in your application, for example, you want to disable library log messages. We can change to config-client what do you think?

luiscoms commented 4 years ago

Any other considerations?