-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve logging and debugging and make Kitura available for iOS
#1522
base: master
Are you sure you want to change the base?
Improve logging and debugging and make Kitura available for iOS
#1522
Conversation
Removed old Kitura-net
iOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Substituting official packages
https://github.com/IBM-Swift/Kitura-NIO.git
with your own personal versionhttps://github.com/DanielMandea/Kitura-NIO.git
is not acceptable.
If you want changes made toKitura-NIO
you need to submit a PR to theKitura-NIO
repo and have it approved there. https://github.com/Kitura/Kitura-NIO -
Removing
https://github.com/IBM-Swift/Kitura-net.git
and forcing everybody to useKitura-NIO
is not a good idea.
If there is an issue caused by defaulting toKitura-Net
then maybe the default can be changed toKitura-NIO
but leaving the option to useKitura-Net
.
I think you can have the logging behaviour with the A pseudo-code like that could work: class RequestLogger: ServerDelegate {
let router: Router
init(_ router: Router) {
self.router = router
}
func handle(request: ServerRequest, response: ServerResponse) {
Log.debug("[\(request.remoteAddress)] \(request.method) HTTP \(request.httpVersionMajor ?? 1).\(request.httpVersionMinor ?? 1) \(request.urlURL)")
router.handle(request: request, response: response)
}
} And then wrap your router: Kitura.addHTTPServer(onPort: 8080, with: RequestLogger(router)) This doesn't solve the NIO issue, but hopefully the log issue. |
|
Description
Added support for accessing
serverRequest
underRouterRequest
in order to improve logging capabilities and debugging. Also added Kitura Nio as the main underlying layer for networking.Motivation and Context
Kitura Nio
is mandatory while running on iOSWhile improving logging as part of our internal
RouterMiddleware
that is specialised for logging we were forced at some point to do the following(request.serverRequest as? HTTPServerRequest)?.buffer?.rewind()
which was impossible due to internal access forserverRequest
How Has This Been Tested?
The change consists in making a constant public instead of keeping it internal.
Checklist: