vterron / public-ip

A Python function to get your public IP address
MIT License
13 stars 6 forks source link

Use a module-level logger instead of the root logger #4

Closed cbates8 closed 5 months ago

cbates8 commented 5 months ago

Update logging config to create a logger based on __name__ rather than using the root logger. This way, users who import public_ip will be able to interact with the package's logger.

For example, let's say a user has their own logger configured, and for debugging purposes they only want to see logging messages generated by their script. The following snippet would prevent any debug or info level logging messages from the public_ip package being output to the console.

import logging

import public_ip

logging.getLogger("public_ip").setLevel(logging.WARNING)

This PR also updates logging level to use debug rather than info.

vterron commented 5 months ago

Thank you! And thanks also for the detailed description.