String concatenation options in Root-Level Logger Middleware

string concatenating using console.log(req.method + " " + req.path + " - " + req.ip) passes but not console.log("%s %s - %s", req.method, req.path, req.ip)
does anyone know why?

app.use(function(req, res, next){
console.log("%s %s - %s", req.method, req.path, req.ip);
next();
});

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15

Challenge: Implement a Root-Level Request Logger Middleware

Link to the challenge:

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