Skip to content

Commit e908cc3

Browse files
authored
Added logger name (#15)
1 parent ad1f017 commit e908cc3

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
## 2.0.2
2+
3+
Enhance:
4+
- Added logger name
5+
16
## 2.0.1
7+
28
Issue:
39
- Remove `HTTP_VIA` header support (unreliable IP information) (@yourcelf)
410

@@ -11,7 +17,7 @@ Enhance:
1117
- Renamed the imported module from `ipware` to `python_ipware` in the `python-ipware` package.
1218
- Old usage: `from ipware import IpWare`
1319
- New usage: `from python_ipware import IpWare`
14-
20+
1521
## 1.0.5
1622

1723
- Enhance: Readme updates

python_ipware/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.1"
1+
__version__ = "2.0.2"

python_ipware/python_ipware.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
IpAddressType = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
77
OptionalIpAddressType = Optional[IpAddressType]
88

9+
logger = logging.getLogger(__name__)
10+
911

1012
class IpWareMeta:
1113
"""
@@ -105,7 +107,7 @@ def get_ip_object(
105107
ip = ipaddress.IPv4Address(ipv4)
106108
except ipaddress.AddressValueError:
107109
# not a valid IP address, return None
108-
logging.info("Invalid ip address. {0}".format(ip_str))
110+
logger.info("Invalid ip address. {0}".format(ip_str))
109111
ip = None
110112
return ip
111113

@@ -324,7 +326,7 @@ def get_best_ip(
324326
"""
325327

326328
if not ip_list:
327-
logging.warning("Invalid ip list provided.")
329+
logger.warning("Invalid ip list provided.")
328330
return None, False
329331

330332
# the incoming ips match our trusted proxy list

0 commit comments

Comments
 (0)