Skip to content

Commit

Permalink
Merge pull request #16 from AiriAPI/staging
Browse files Browse the repository at this point in the history
Fixed a small bug again
  • Loading branch information
kyrea authored Sep 23, 2021
2 parents e3aa79e + 8fbd2cb commit 7b5bc19
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
44 changes: 22 additions & 22 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ if (process.env.LOGGER === 'true') {
// maxFiles: '14d',
// })

app
.use
/* Winson logger */
// app
// .use
// /* Winson logger */

// expressWinston.logger({
// transports: [transport],
// format: winston.format.combine(
// winston.format.colorize(),
// winston.format.json()
// ),
// meta: true,
// msg(req, res) {
// return `${res.statusCode} - ${req.method} - ${
// res.responseTime
// }ms - IP: ${req.ip} IPs: ${requestIp.getClientIp(req)}`
// },
// expressFormat: true,
// colorize: false,
// ignoreRoute(req, res) {
// return false
// },
// })
()
// // expressWinston.logger({
// // transports: [transport],
// // format: winston.format.combine(
// // winston.format.colorize(),
// // winston.format.json()
// // ),
// // meta: true,
// // msg(req, res) {
// // return `${res.statusCode} - ${req.method} - ${
// // res.responseTime
// // }ms - IP: ${req.ip} IPs: ${requestIp.getClientIp(req)}`
// // },
// // expressFormat: true,
// // colorize: false,
// // ignoreRoute(req, res) {
// // return false
// // },
// // })
// ()
app.use(ipLogger)
}

Expand Down
6 changes: 2 additions & 4 deletions src/handlers/logger/ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ const requestIp = require('request-ip')

// Logger In One File
module.exports.ipLogger = function ipLogger(req, res, next) {
const log = `${new Date()} - STATUS=${res.statusCode} - METHOD=${
const log = `${new Date()} - STATUS=${res.statusCode} - METHOD=${
req.method
} - IP=${req.ip} | ${requestIp.getClientIp(req)} - URL=${
req.originalUrl
} - RES_TIME: ${res.responseTime}ms\n`
} - IP=${req.ip} | ${requestIp.getClientIp(req)} - URL=${req.originalUrl}\n`

// fs.appendFile('./logs/ip-logs.log', log, err => {
// if (err) throw err
Expand Down

0 comments on commit 7b5bc19

Please sign in to comment.