ctx: Add missing log to context

This commit is contained in:
Jonatan Nilsson 2021-10-10 19:57:48 +00:00
parent 91588fc3ee
commit 6569ff75de
2 changed files with 5 additions and 1 deletions

View file

@ -371,6 +371,7 @@ export class Flaska {
} }
let ctx = { let ctx = {
log: this.log,
req: req, req: req,
res: res, res: res,
method: req.method, method: req.method,

View file

@ -125,7 +125,9 @@ t.describe('#requestStart()', function() {
const assertMethod = 'test' const assertMethod = 'test'
const assertPath = '/test/me' const assertPath = '/test/me'
const assertSearch = '?asdf=test' const assertSearch = '?asdf=test'
let flaska = new Flaska({}, faker) const assertLog = { info: function() {}, error: function() {} }
let flaska = new Flaska({ log: assertLog }, faker)
assert.strictEqual(flaska.log, assertLog)
flaska.compile() flaska.compile()
flaska.routers.test = { flaska.routers.test = {
@ -148,6 +150,7 @@ t.describe('#requestStart()', function() {
assert.strictEqual(ctx.body, null) assert.strictEqual(ctx.body, null)
assert.strictEqual(ctx.type, null) assert.strictEqual(ctx.type, null)
assert.strictEqual(ctx.length, null) assert.strictEqual(ctx.length, null)
assert.strictEqual(ctx.log, assertLog)
cb() cb()
} catch (err) { cb(err) } } catch (err) { cb(err) }
} }