Skip to content

Instantly share code, notes, and snippets.

@vighnesh153
Created December 28, 2020 04:38
Show Gist options
  • Save vighnesh153/5afa50be7bf190d6a7f9a4c7a6d01f87 to your computer and use it in GitHub Desktop.
Save vighnesh153/5afa50be7bf190d6a7f9a4c7a6d01f87 to your computer and use it in GitHub Desktop.
const winston = require("winston");
const logger = winston.createLogger({
transports: new winston.transports.File({
filename: "./hello.log",
format: winston.format.combine(
winston.format.timestamp({
format: "YYYY-MM-DD HH:mm:ss",
}),
winston.format.json()
),
}),
});
logger.info("Hello");
const express = require("express");
const app = express();
app.use("/status", (req, res) => {
logger.info("/status start");
res.sendStatus(200);
logger.info("/status end");
});
app.use("/p", (req, res) => {
logger.info("/p start");
let i = 0;
const max = 10 ** 10;
while (i < max) {
i += 1;
}
res.send(`${i}`);
logger.info("/p end");
});
app.listen(3005, () => {
logger.silly("Serving on port: 3005");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment