简体   繁体   中英

winston logging http transport no port

I was wondering how I can use winston logging using the http transport, without any specified port?

I have a server and want to send all the error logs to it, but its just http://xx/api/v1/log

But in winston I weirdly enough cannot specify an empty port?

const logger = createLogger({
  level: "debug", 
  format: combine(
    colorize(),
    timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
    format.errors({ stack: true }),
    logFormat
  ),
  transports: [
    new transports.Console(),
    new transports.Http({
      level: "error",
      host: "xxx.herokuapp.com",
      port: undefined, // but this defaults to port 80
      path: "/api/v1/log",
    }),
  ],
});

Try to use

port: 443

More information here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM