Unknown reason for this error - Root level logger middleware should be active

I am trying to finish this " Basic Node and Express
Implement a Root-Level Request Logger Middleware

I do not understand why I keep getting this error when running the test:
Root level logger middleware should be active

My code is as below -

var express = require('express');
var app = express();

/** 7) Implement a Root-Level Request Logger Middleware */
app.use((request, response, next) => {
  console.log(request.method + ' ' + request.path + '-' + request.ip);
  next();
})

Hi @yuchit, it may just be a simple case of formatting issue.
Read at the challenge description:

Note that there is a space between method and path and that the dash separating path and ip is surrounded by a space on both sides

In your code I don’t see a space with the dash

request.path + '-' + request.ip

Hope this helps.

@Marmiz
Ah I didn’t even notice this part of description…

the dash needs be surrounded by a space on both sides…

You have good eyes!:+1:
Thank you!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.