Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed ENABLE_LOG #103

Merged
merged 1 commit into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ INTERNAL_ACCESS_TOKEN = 'internal-access-token'
# Mentor screct code for registering
MENTOR_SECRET_CODE = 'secret-code'

#Enable logging of network request
ENABLE_LOG = true

# JWT Access Token expiry In Days
ACCESS_TOKEN_EXPIRY = '1'

Expand Down
24 changes: 10 additions & 14 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,17 @@ app.use(bodyParser.json({ limit: '50MB' }))
app.use(express.static('public'))

/* Logs request info if environment is configured to enable log */
if (process.env.ENABLE_LOG === 'true') {
app.all('*', (req, res, next) => {
logger.info('***User Service Request Log***', {
request: {
requestType: `Request Type ${req.method} for ${req.url} on ${new Date()} from ${
req.headers['user-agent']
}`,
requestHeaders: req.headers,
requestBody: req.body,
requestFiles: req.files,
},
})
next()
app.all('*', (req, res, next) => {
logger.info('***User Service Request Log***', {
request: {
requestType: `Request Type ${req.method} for ${req.url} on ${new Date()} from ${req.headers['user-agent']}`,
requestHeaders: req.headers,
requestBody: req.body,
requestFiles: req.files,
},
})
}
next()
})

/* Registered routes here */
require('./routes')(app)
Expand Down