Search code examples
visual-studio-codeparse-platformparse-serverwinstonexpress-winston

How to add express-winston to Parse Server example?


How do I use express-winston to log all http requests sent to Parse Server?

I tried this:

var express = require('express');
var ParseServer = require('parse-server').ParseServer;

const app = express();
const winston = require('winston')
const expressWinston = require('express-winston');

app.use(expressWinston.logger({
    transports: [
        new winston.transports.Console()
    ],
    format: winston.format.combine(
        winston.format.colorize(),
        winston.format.json()
    )
}));

app.use('/parse', new ParseServer({
  // ...
}));

const httpServer = require('http').createServer(app);
httpServer.listen(1337);

But there is no log output in the console from express-winston.

What's missing here?


Solution

  • Logging actually worked, but the output was not displayed to the debug console.

    I was debugging in Visual Studio Code and had to set "outputCapture": "std" in the launch configuration to see the logs as described in the launch attributes.