You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cb...@apache.org on 2017/08/22 08:27:37 UTC
[incubator-openwhisk] branch master updated: Readd BasicHttpService
log line (#2654)
This is an automated email from the ASF dual-hosted git repository.
cbickel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 0ba4418 Readd BasicHttpService log line (#2654)
0ba4418 is described below
commit 0ba4418c0bef83a9a04fdf1dfbfc23079fe22cd8
Author: Markus Thömmes <ma...@me.com>
AuthorDate: Tue Aug 22 10:27:35 2017 +0200
Readd BasicHttpService log line (#2654)
---
.../main/scala/whisk/http/BasicHttpService.scala | 24 +++++++++-------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/common/scala/src/main/scala/whisk/http/BasicHttpService.scala b/common/scala/src/main/scala/whisk/http/BasicHttpService.scala
index 0c92146..502d0e9 100644
--- a/common/scala/src/main/scala/whisk/http/BasicHttpService.scala
+++ b/common/scala/src/main/scala/whisk/http/BasicHttpService.scala
@@ -20,17 +20,13 @@ package whisk.http
import scala.collection.immutable.Seq
import scala.concurrent.Await
import scala.concurrent.duration.DurationInt
-
import akka.actor.ActorSystem
import akka.event.Logging
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.HttpRequest
-import akka.http.scaladsl.server.Directives
-import akka.http.scaladsl.server.RejectionHandler
-import akka.http.scaladsl.server.Route
+import akka.http.scaladsl.server._
import akka.http.scaladsl.server.RouteResult.Rejected
-import akka.http.scaladsl.server.UnacceptedResponseContentTypeRejection
import akka.http.scaladsl.server.directives.DebuggingDirectives
import akka.http.scaladsl.server.directives.LogEntry
import akka.stream.ActorMaterializer
@@ -68,7 +64,7 @@ trait BasicHttpService extends Directives with TransactionCounter {
* Gets the log level for a given route. The default is
* InfoLevel so override as needed.
*
- * @param the route
+ * @param route the route to determine the loglevel for
* @return a log level for the route
*/
def loglevelForRoute(route: String): Logging.LogLevel = Logging.InfoLevel
@@ -88,10 +84,10 @@ trait BasicHttpService extends Directives with TransactionCounter {
*/
def route: Route = {
assignId { implicit transid =>
- handleRejections(customRejectionHandler) {
- prioritizeRejections {
- DebuggingDirectives.logRequest(logRequestInfo _) {
- DebuggingDirectives.logRequestResult(logResponseInfo _) {
+ DebuggingDirectives.logRequest(logRequestInfo _) {
+ DebuggingDirectives.logRequestResult(logResponseInfo _) {
+ handleRejections(customRejectionHandler) {
+ prioritizeRejections {
toStrictEntity(30.seconds) {
routes
}
@@ -107,16 +103,16 @@ trait BasicHttpService extends Directives with TransactionCounter {
/** Generates log entry for every request. */
protected def logRequestInfo(req: HttpRequest)(implicit tid: TransactionId): LogEntry = {
- val m = req.method.name.toString
+ val m = req.method.name
val p = req.uri.path.toString
val q = req.uri.query().toString
val l = loglevelForRoute(p)
LogEntry(s"[$tid] $m $p $q", l)
}
- protected def logResponseInfo(req: HttpRequest)(implicit tid: TransactionId): Any => Option[LogEntry] = {
- case res: HttpResponse =>
- val m = req.method.toString
+ protected def logResponseInfo(req: HttpRequest)(implicit tid: TransactionId): RouteResult => Option[LogEntry] = {
+ case RouteResult.Complete(res: HttpResponse) =>
+ val m = req.method.name
val p = req.uri.path.toString
val l = loglevelForRoute(p)
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].