paulc / dnslib

A Python library to encode/decode DNS wire-format packets
https://github.com/paulc/dnslib
BSD 2-Clause "Simplified" License
295 stars 84 forks source link

Nice2Have: Define a function for output inside of DNSLogger instead of print, would make it easy to send to custom loggers #31

Closed DmitryFrolovTri closed 2 years ago

DmitryFrolovTri commented 2 years ago

Not an issue as such, but

Needed to attach a custom logger to DNSLogger, format was fine, but needed to overload every method as print was used... It would have been so much better if there was a log_print or _print or _output method in the DNSLogger class instead. Then using a customer logger w/o format change would be much simpler. If you could implement this would be great. :) Great code, btw!

https://github.com/paulc/dnslib/blob/729a655b069303de089a9ca3904378b15dd17ff1/dnslib/server.py#L178-L302

paulc commented 2 years ago

That's a really good idea, thanks. I've added logf parameter in the DNSLogger constructor and released a new version (https://pypi.org/project/dnslib/0.9.19/)

DmitryFrolovTri commented 2 years ago

Thank you! Thank you very much!