mirror of
https://github.com/yswery/PHP-DNS-SERVER.git
synced 2026-04-25 17:25:53 +03:00
[GH-ISSUE #25] Is there any output? #11
Labels
No labels
bug
enhancement
enhancement
hacktoberfest
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/PHP-DNS-SERVER#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nkakouros on GitHub (Aug 1, 2017).
Original GitHub issue: https://github.com/yswery/PHP-DNS-SERVER/issues/25
Awesome project! To my question.
It would be nice to somewhere to log requests. Is there any such capability now?
@yswery commented on GitHub (Aug 1, 2017):
Currently speaking, no there is no logging
However would love to see this come through as a PR if you got time, some foreground output/logging
In the
ds_handle_query()method you will find the first entry point where you can see who made the query and what the query was: https://github.com/yswery/PHP-DNS-SERVER/blob/master/src/Server.php#L62later in this method the question query is decoded so you will have the ability to print something in there about who did the DNS query and what they asked for and what the response is.
I think thats the best place to start with output logs inside that method, if you are not familiar with the protocol, a good way to go through this would be to just print out all the variables one by one inside the
ds_handle_query()method to see what they store as your query the DNS server and that way by trial and error you can see and learn what holds what :)Would be good to have this logging as some configurable option in order to turn it off/on for those who want it.
@samuelwilliams commented on GitHub (Aug 1, 2017):
It might be worth adding a PSR Logger interface to the constructor or the aware interface to the class. You could then use a null logger as the default, or implement some other logging library such as Monolog.
@ivanstan commented on GitHub (May 17, 2018):
Currently working on Event Listeners in Server class, my idea was to create listener and than do the logging inside them. I would also recommend throwing Exception instead of using
ds_handle_query()in cases where it should lead to stopping server@samuelwilliams commented on GitHub (Sep 15, 2018):
You can implement it with the EchoLogger in branch version-1