Log operation performed on the request
Addressing: #18 (closed)
What has been done in this MR?
- Adding Logger class with different levels of logging. Passing the object around between functions, to log events. At the moment we are only logging
info
events, that are aggregated at CloudFlare at the request level. - Adding config for the logging level to the ENV variables.
How do the logs show up on CloudFlare?
CloudFlare aggregates all the output per request, and shows them in this section, which is empty now logs: []
Steps to validate
Validate in Passthrough mode
- Checkout this branch on GDK / gitlab-http-router
- Run
gdk reconfigure
to make sure to generate thewrangler.toml
file. - Make sure in
wrangler.toml
dev
environment, and it's running inpassthrough
mode forGITLAB_RULES_CONFIG
- Make requests to
gdk.test:3000
in the browser, and watch the logs ingdk tail gitlab-http-router
. You should see items like{ rule_applied: '0_proxy', rule_action: 'proxy' }
and{ proxy_host: 'gdk.test:3333' }
.
Validate in Classify Mode
- Checkout this branch on GDK / gitlab-http-router
- TODO: I will provide the rest of the steps soon.
- Change your
wrangler.toml
file indev
environment to usefirstcell
instead ofpassthrough
forGITLAB_RULES_CONFIG
. - In
gdk tail gitlab-http-router
you should see items containing{ cache: 'miss', cache_fetch_ms: 0 }
and{ source: .... }
Edited by Omar Qunsul