@qpoint/router
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -14,2 +14,3 @@ /// <reference types="@cloudflare/workers-types" /> | ||
htmlRewriter: HTMLRewriter; | ||
log: (message: string) => void; | ||
constructor(request: Request, env: Env, ctx: ExecutionContext, state?: Object); | ||
@@ -16,0 +17,0 @@ get req(): Request; |
@@ -29,2 +29,23 @@ "use strict"; | ||
htmlRewriter; // a rewriter instance for modifying html as a stream | ||
// Logging at the edge has the potential to overwhelm collection sinks | ||
// and consume bandwidth for any external logging solutions that will | ||
// need to submit over http(s). Additionally, setting a context-wide | ||
// log facility level will likely produce undesirable results as all | ||
// adapters would potentially become very noisy when the intended | ||
// result is to simply debug a single adapter. | ||
// | ||
// To this end there is only a single log function that all adapters | ||
// should (ideally) use, without facility levels. Each adapter should | ||
// adopt a pattern whereby the log-level (or perhaps debug-mode) can | ||
// be set or enabled through the adapter configuration, context state, | ||
// or both. | ||
// | ||
// Example: adapter "foo" only logs errors by default. To toggle debug mode, | ||
// add a simple adapter that just initializes the state, above "foo" in the stack. | ||
// | ||
// export function (ctx, next) { | ||
// ctx.state['foo.debug'] = true | ||
// return next() | ||
// } | ||
log; | ||
constructor(request, env, ctx, state = {}) { | ||
@@ -53,2 +74,4 @@ // set the request from the event | ||
this.startedAt = Date.now(); | ||
// set the default log function to console.log | ||
this.log = (message) => { console.log(message); }; | ||
} | ||
@@ -55,0 +78,0 @@ // A few shortcut getters/setters |
{ | ||
"name": "@qpoint/router", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "Qpoint - an intelligent edge router framework", | ||
@@ -5,0 +5,0 @@ "author": "Tyler Flint <tyler@qpoint.io>", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29308
246