Skip to content

Commit

Permalink
Merge pull request #68 from line-o/feat/less-logging
Browse files Browse the repository at this point in the history
feat: request and ambigous route log level
  • Loading branch information
wolfgangmm authored Feb 4, 2023
2 parents 481d0d0 + b4e822f commit a59ded1
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
exist-version: [latest, release, 5.4.1, 5.0.0]
exist-version: [latest, release, 5.5.1]
services:
exist:
image: existdb/existdb:${{ matrix.exist-version }}
Expand Down
6 changes: 3 additions & 3 deletions content/router.xql
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ declare function router:route ($api-files as xs:string+, $lookup as function(xs:
}

return (
util:log("info", ``[[`{$request-data?id}`] request `{$request-data?method}` `{$request-data?path}`]``),
util:log("debug", ``[[`{$request-data?id}`] request `{$request-data?method}` `{$request-data?path}`]``),
try {
(: load router definitions :)
let $specs :=
Expand All @@ -114,7 +114,7 @@ declare function router:route ($api-files as xs:string+, $lookup as function(xs:
$matching-routes
else (
(: if there are multiple matches, prefer the one matching the longest pattern and the highest priority :)
util:log("warn", "ambigous route: " || $request-data?path),
util:log("debug", "ambigous route: " || $request-data?path),
head(sort($matching-routes, (), router:route-specificity#1))
)

Expand Down Expand Up @@ -227,7 +227,7 @@ declare %private function router:process-request ($pattern-map as map(*), $looku

return (
router:write-response($status, $response, $route),
util:log("info", ``[[`{$base-request?id}`] `{$base-request?method}` `{$base-request?path}`: `{$status}`]``)
util:log("debug", ``[[`{$base-request?id}`] `{$base-request?method}` `{$base-request?path}`: `{$status}`]``)
)
};

Expand Down
74 changes: 66 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"license": "GPL-3.0",
"devDependencies": {
"@existdb/gulp-exist": "^4.3.2",
"@existdb/gulp-exist": "^4.4.0",
"@existdb/gulp-replace-tmpl": "^1.0.4",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
Expand Down

0 comments on commit a59ded1

Please # to comment.