Merge pull request #7906 from overleaf/em-downgrade-logs
Downgrade all INFO logs to DEBUG GitOrigin-RevId: 05ed582ef0721fcada059f0ad158565f50feca27
This commit is contained in:
+4
-2
@@ -60,8 +60,10 @@ if (!module.parent) {
|
||||
Promise.all([mongodb.waitForDb(), mongoose.connectionPromise])
|
||||
.then(() => {
|
||||
Server.server.listen(port, host, function () {
|
||||
logger.info(`web starting up, listening on ${host}:${port}`)
|
||||
logger.info(`${require('http').globalAgent.maxSockets} sockets enabled`)
|
||||
logger.debug(`web starting up, listening on ${host}:${port}`)
|
||||
logger.debug(
|
||||
`${require('http').globalAgent.maxSockets} sockets enabled`
|
||||
)
|
||||
// wait until the process is ready before monitoring the event loop
|
||||
metrics.event_loop.monitor(logger)
|
||||
})
|
||||
|
||||
@@ -65,7 +65,7 @@ function recordEventForSession(session, event, segmentation) {
|
||||
if (_isAnalyticsDisabled() || _isSmokeTestUser(userId)) {
|
||||
return
|
||||
}
|
||||
logger.info({
|
||||
logger.debug({
|
||||
analyticsId,
|
||||
userId,
|
||||
event,
|
||||
|
||||
@@ -190,7 +190,7 @@ const AuthenticationController = {
|
||||
return done(err)
|
||||
}
|
||||
if (!isAllowed) {
|
||||
logger.log({ email }, 'too many login requests')
|
||||
logger.debug({ email }, 'too many login requests')
|
||||
return done(null, null, {
|
||||
text: req.i18n.translate('to_many_login_requests_2_mins'),
|
||||
type: 'error',
|
||||
@@ -222,7 +222,7 @@ const AuthenticationController = {
|
||||
done(null, user)
|
||||
} else {
|
||||
AuthenticationController._recordFailedLogin()
|
||||
logger.log({ email }, 'failed log in')
|
||||
logger.debug({ email }, 'failed log in')
|
||||
done(null, false, {
|
||||
text: req.i18n.translate('email_or_password_wrong_try_again'),
|
||||
type: 'error',
|
||||
@@ -372,7 +372,7 @@ const AuthenticationController = {
|
||||
} else if (SessionManager.isUserLoggedIn(req.session)) {
|
||||
next()
|
||||
} else {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ url: req.url },
|
||||
'user trying to access endpoint not in global whitelist'
|
||||
)
|
||||
@@ -475,7 +475,7 @@ const AuthenticationController = {
|
||||
},
|
||||
|
||||
_redirectToLoginPage(req, res) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ url: req.url },
|
||||
'user not logged in so redirecting to login page'
|
||||
)
|
||||
@@ -486,7 +486,7 @@ const AuthenticationController = {
|
||||
},
|
||||
|
||||
_redirectToReconfirmPage(req, res, user) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ url: req.url },
|
||||
'user needs to reconfirm so redirecting to reconfirm page'
|
||||
)
|
||||
@@ -496,7 +496,7 @@ const AuthenticationController = {
|
||||
},
|
||||
|
||||
_redirectToRegisterPage(req, res) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ url: req.url },
|
||||
'user not logged in so redirecting to register page'
|
||||
)
|
||||
@@ -617,7 +617,7 @@ function _loginAsyncHandlers(req, user, anonymousAnalyticsId, isNewUser) {
|
||||
})
|
||||
Analytics.identifyUser(user._id, anonymousAnalyticsId, isNewUser)
|
||||
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ email: user.email, user_id: user._id.toString() },
|
||||
'successful log in'
|
||||
)
|
||||
|
||||
@@ -64,10 +64,10 @@ async function ensureUserCanReadProject(req, res, next) {
|
||||
token
|
||||
)
|
||||
if (canRead) {
|
||||
logger.log({ userId, projectId }, 'allowing user read access to project')
|
||||
logger.debug({ userId, projectId }, 'allowing user read access to project')
|
||||
return next()
|
||||
}
|
||||
logger.log({ userId, projectId }, 'denying user read access to project')
|
||||
logger.debug({ userId, projectId }, 'denying user read access to project')
|
||||
HttpErrorHandler.forbidden(req, res)
|
||||
}
|
||||
|
||||
@@ -114,13 +114,13 @@ async function ensureUserCanWriteProjectContent(req, res, next) {
|
||||
token
|
||||
)
|
||||
if (canWrite) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ userId, projectId },
|
||||
'allowing user write access to project content'
|
||||
)
|
||||
return next()
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ userId, projectId },
|
||||
'denying user write access to project settings'
|
||||
)
|
||||
@@ -137,21 +137,21 @@ async function ensureUserCanAdminProject(req, res, next) {
|
||||
token
|
||||
)
|
||||
if (canAdmin) {
|
||||
logger.log({ userId, projectId }, 'allowing user admin access to project')
|
||||
logger.debug({ userId, projectId }, 'allowing user admin access to project')
|
||||
return next()
|
||||
}
|
||||
logger.log({ userId, projectId }, 'denying user admin access to project')
|
||||
logger.debug({ userId, projectId }, 'denying user admin access to project')
|
||||
HttpErrorHandler.forbidden(req, res)
|
||||
}
|
||||
|
||||
async function ensureUserIsSiteAdmin(req, res, next) {
|
||||
const userId = _getUserId(req)
|
||||
if (await AuthorizationManager.promises.isUserSiteAdmin(userId)) {
|
||||
logger.log({ userId }, 'allowing user admin access to site')
|
||||
logger.debug({ userId }, 'allowing user admin access to site')
|
||||
return next()
|
||||
}
|
||||
if (handleAdminDomainRedirect(req, res)) return
|
||||
logger.log({ userId }, 'denying user admin access to site')
|
||||
logger.debug({ userId }, 'denying user admin access to site')
|
||||
_redirectToRestricted(req, res, next)
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ function restricted(req, res, next) {
|
||||
return res.render('user/restricted', { title: 'restricted' })
|
||||
}
|
||||
const { from } = req.query
|
||||
logger.log({ from }, 'redirecting to login')
|
||||
logger.debug({ from }, 'redirecting to login')
|
||||
if (from) {
|
||||
AuthenticationController.setRedirectInSession(req, from)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ const SessionManager = require('../Authentication/SessionManager')
|
||||
const BetaProgramController = {
|
||||
optIn(req, res, next) {
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
logger.log({ userId }, 'user opting in to beta program')
|
||||
logger.debug({ userId }, 'user opting in to beta program')
|
||||
if (userId == null) {
|
||||
return next(new Error('no user id in session'))
|
||||
}
|
||||
@@ -22,7 +22,7 @@ const BetaProgramController = {
|
||||
|
||||
optOut(req, res, next) {
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
logger.log({ userId }, 'user opting out of beta program')
|
||||
logger.debug({ userId }, 'user opting out of beta program')
|
||||
if (userId == null) {
|
||||
return next(new Error('no user id in session'))
|
||||
}
|
||||
@@ -36,7 +36,10 @@ const BetaProgramController = {
|
||||
|
||||
optInPage(req, res, next) {
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
logger.log({ user_id: userId }, 'showing beta participation page for user')
|
||||
logger.debug(
|
||||
{ user_id: userId },
|
||||
'showing beta participation page for user'
|
||||
)
|
||||
UserGetter.getUser(userId, function (err, user) {
|
||||
if (err) {
|
||||
OError.tag(err, 'error fetching user', {
|
||||
|
||||
@@ -13,7 +13,7 @@ function getBrandVariationById(brandVariationId, callback) {
|
||||
if (brandVariationId == null || brandVariationId === '') {
|
||||
return callback(new Error('Branding variation id not provided'))
|
||||
}
|
||||
logger.log({ brandVariationId }, 'fetching brand variation details from v1')
|
||||
logger.debug({ brandVariationId }, 'fetching brand variation details from v1')
|
||||
V1Api.request(
|
||||
{
|
||||
uri: `/api/v2/brand_variations/${brandVariationId}`,
|
||||
|
||||
@@ -39,7 +39,7 @@ async function removeSelfFromProject(req, res, next) {
|
||||
|
||||
async function getAllMembers(req, res, next) {
|
||||
const projectId = req.params.Project_id
|
||||
logger.log({ projectId }, 'getting all active members for project')
|
||||
logger.debug({ projectId }, 'getting all active members for project')
|
||||
let members
|
||||
try {
|
||||
members = await CollaboratorsGetter.promises.getAllInvitedMembers(projectId)
|
||||
|
||||
@@ -110,10 +110,13 @@ async function addUserIdToProject(
|
||||
}
|
||||
if (privilegeLevel === PrivilegeLevels.READ_AND_WRITE) {
|
||||
level = { collaberator_refs: userId }
|
||||
logger.log({ privileges: 'readAndWrite', userId, projectId }, 'adding user')
|
||||
logger.debug(
|
||||
{ privileges: 'readAndWrite', userId, projectId },
|
||||
'adding user'
|
||||
)
|
||||
} else if (privilegeLevel === PrivilegeLevels.READ_ONLY) {
|
||||
level = { readOnly_refs: userId }
|
||||
logger.log({ privileges: 'readOnly', userId, projectId }, 'adding user')
|
||||
logger.debug({ privileges: 'readOnly', userId, projectId }, 'adding user')
|
||||
} else {
|
||||
throw new Error(`unknown privilegeLevel: ${privilegeLevel}`)
|
||||
}
|
||||
@@ -146,7 +149,7 @@ async function transferProjects(fromUserId, toUserId) {
|
||||
{ _id: 1 }
|
||||
).exec()
|
||||
const projectIds = projects.map(p => p._id)
|
||||
logger.log({ projectIds, fromUserId, toUserId }, 'transferring projects')
|
||||
logger.debug({ projectIds, fromUserId, toUserId }, 'transferring projects')
|
||||
|
||||
await Project.updateMany(
|
||||
{ owner_ref: fromUserId },
|
||||
|
||||
@@ -30,7 +30,7 @@ const rateLimiter = require('../../infrastructure/RateLimiter')
|
||||
module.exports = CollaboratorsInviteController = {
|
||||
getAllInvites(req, res, next) {
|
||||
const projectId = req.params.Project_id
|
||||
logger.log({ projectId }, 'getting all active invites for project')
|
||||
logger.debug({ projectId }, 'getting all active invites for project')
|
||||
return CollaboratorsInviteHandler.getAllInvites(
|
||||
projectId,
|
||||
function (err, invites) {
|
||||
@@ -50,7 +50,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
callback = function () {}
|
||||
}
|
||||
if (Settings.restrictInvitesToExistingAccounts === true) {
|
||||
logger.log({ email }, 'checking if user exists with this email')
|
||||
logger.debug({ email }, 'checking if user exists with this email')
|
||||
return UserGetter.getUserByAnyEmail(
|
||||
email,
|
||||
{ _id: 1 },
|
||||
@@ -102,13 +102,13 @@ module.exports = CollaboratorsInviteController = {
|
||||
const sendingUser = SessionManager.getSessionUser(req.session)
|
||||
const sendingUserId = sendingUser._id
|
||||
if (email === sendingUser.email) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, email, sendingUserId },
|
||||
'cannot invite yourself to project'
|
||||
)
|
||||
return res.json({ invite: null, error: 'cannot_invite_self' })
|
||||
}
|
||||
logger.log({ projectId, email, sendingUserId }, 'inviting to project')
|
||||
logger.debug({ projectId, email, sendingUserId }, 'inviting to project')
|
||||
return LimitationsManager.canAddXCollaborators(
|
||||
projectId,
|
||||
1,
|
||||
@@ -118,7 +118,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
return next(error)
|
||||
}
|
||||
if (!allowed) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, email, sendingUserId },
|
||||
'not allowed to invite more users to project'
|
||||
)
|
||||
@@ -127,7 +127,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
;({ email, privileges } = req.body)
|
||||
email = EmailHelper.parseEmail(email)
|
||||
if (email == null || email === '') {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, email, sendingUserId },
|
||||
'invalid email address'
|
||||
)
|
||||
@@ -158,7 +158,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
return next(err)
|
||||
}
|
||||
if (!shouldAllowInvite) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ email, projectId, sendingUserId },
|
||||
'not allowed to send an invite to this email address'
|
||||
)
|
||||
@@ -181,7 +181,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
})
|
||||
return next(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, email, sendingUserId },
|
||||
'invite created'
|
||||
)
|
||||
@@ -204,7 +204,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
revokeInvite(req, res, next) {
|
||||
const projectId = req.params.Project_id
|
||||
const inviteId = req.params.invite_id
|
||||
logger.log({ projectId, inviteId }, 'revoking invite')
|
||||
logger.debug({ projectId, inviteId }, 'revoking invite')
|
||||
return CollaboratorsInviteHandler.revokeInvite(
|
||||
projectId,
|
||||
inviteId,
|
||||
@@ -229,7 +229,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
resendInvite(req, res, next) {
|
||||
const projectId = req.params.Project_id
|
||||
const inviteId = req.params.invite_id
|
||||
logger.log({ projectId, inviteId }, 'resending invite')
|
||||
logger.debug({ projectId, inviteId }, 'resending invite')
|
||||
const sendingUser = SessionManager.getSessionUser(req.session)
|
||||
return CollaboratorsInviteController._checkRateLimit(
|
||||
sendingUser._id,
|
||||
@@ -263,7 +263,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
const projectId = req.params.Project_id
|
||||
const { token } = req.params
|
||||
const _renderInvalidPage = function () {
|
||||
logger.log({ projectId }, 'invite not valid, rendering not-valid page')
|
||||
logger.debug({ projectId }, 'invite not valid, rendering not-valid page')
|
||||
return res.render('project/invite/not-valid', { title: 'Invalid Invite' })
|
||||
}
|
||||
// check if the user is already a member of the project
|
||||
@@ -279,7 +279,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
return next(err)
|
||||
}
|
||||
if (isMember) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, userId: currentUser._id },
|
||||
'user is already a member of this project, redirecting'
|
||||
)
|
||||
@@ -298,7 +298,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
}
|
||||
// check if invite is gone, or otherwise non-existent
|
||||
if (invite == null) {
|
||||
logger.log({ projectId }, 'no invite found for this token')
|
||||
logger.debug({ projectId }, 'no invite found for this token')
|
||||
return _renderInvalidPage()
|
||||
}
|
||||
// check the user who sent the invite exists
|
||||
@@ -313,7 +313,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
return next(err)
|
||||
}
|
||||
if (owner == null) {
|
||||
logger.log({ projectId }, 'no project owner found')
|
||||
logger.debug({ projectId }, 'no project owner found')
|
||||
return _renderInvalidPage()
|
||||
}
|
||||
// fetch the project name
|
||||
@@ -328,7 +328,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
return next(err)
|
||||
}
|
||||
if (project == null) {
|
||||
logger.log({ projectId }, 'no project found')
|
||||
logger.debug({ projectId }, 'no project found')
|
||||
return _renderInvalidPage()
|
||||
}
|
||||
// finally render the invite
|
||||
@@ -352,7 +352,7 @@ module.exports = CollaboratorsInviteController = {
|
||||
const projectId = req.params.Project_id
|
||||
const { token } = req.params
|
||||
const currentUser = SessionManager.getSessionUser(req.session)
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, userId: currentUser._id },
|
||||
'got request to accept invite'
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ projectId }, 'fetching invites for project')
|
||||
logger.debug({ projectId }, 'fetching invites for project')
|
||||
return ProjectInvite.find({ projectId }, function (err, invites) {
|
||||
if (err != null) {
|
||||
OError.tag(err, 'error getting invites from mongo', {
|
||||
@@ -36,7 +36,7 @@ const CollaboratorsInviteHandler = {
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, count: invites.length },
|
||||
'found invites for project'
|
||||
)
|
||||
@@ -48,7 +48,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ projectId }, 'counting invites for project')
|
||||
logger.debug({ projectId }, 'counting invites for project')
|
||||
return ProjectInvite.countDocuments({ projectId }, function (err, count) {
|
||||
if (err != null) {
|
||||
OError.tag(err, 'error getting invites from mongo', {
|
||||
@@ -77,7 +77,10 @@ const CollaboratorsInviteHandler = {
|
||||
return callback(err)
|
||||
}
|
||||
if (existingUser == null) {
|
||||
logger.log({ projectId, email }, 'no existing user found, returning')
|
||||
logger.debug(
|
||||
{ projectId, email },
|
||||
'no existing user found, returning'
|
||||
)
|
||||
return callback(null)
|
||||
}
|
||||
return ProjectGetter.getProject(
|
||||
@@ -92,7 +95,7 @@ const CollaboratorsInviteHandler = {
|
||||
return callback(err)
|
||||
}
|
||||
if (project == null) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId },
|
||||
'no project found while sending notification, returning'
|
||||
)
|
||||
@@ -126,7 +129,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, inviteId: invite._id },
|
||||
'sending notification and email for invite'
|
||||
)
|
||||
@@ -158,7 +161,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, sendingUserId: sendingUser._id, email, privileges },
|
||||
'adding invite'
|
||||
)
|
||||
@@ -211,7 +214,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ projectId, inviteId }, 'removing invite')
|
||||
logger.debug({ projectId, inviteId }, 'removing invite')
|
||||
return ProjectInvite.deleteOne(
|
||||
{ projectId, _id: inviteId },
|
||||
function (err) {
|
||||
@@ -235,7 +238,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ projectId, inviteId }, 'resending invite email')
|
||||
logger.debug({ projectId, inviteId }, 'resending invite email')
|
||||
return ProjectInvite.findOne(
|
||||
{ _id: inviteId, projectId },
|
||||
function (err, invite) {
|
||||
@@ -276,7 +279,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ projectId }, 'fetching invite by token')
|
||||
logger.debug({ projectId }, 'fetching invite by token')
|
||||
return ProjectInvite.findOne(
|
||||
{ projectId, token: tokenString },
|
||||
function (err, invite) {
|
||||
@@ -299,7 +302,7 @@ const CollaboratorsInviteHandler = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ projectId, userId: user._id }, 'accepting invite')
|
||||
logger.debug({ projectId, userId: user._id }, 'accepting invite')
|
||||
return CollaboratorsInviteHandler.getInviteByToken(
|
||||
projectId,
|
||||
tokenString,
|
||||
@@ -313,7 +316,7 @@ const CollaboratorsInviteHandler = {
|
||||
}
|
||||
if (!invite) {
|
||||
err = new Errors.NotFoundError('no matching invite found')
|
||||
logger.log({ err, projectId }, 'no matching invite found')
|
||||
logger.debug({ err, projectId }, 'no matching invite found')
|
||||
return callback(err)
|
||||
}
|
||||
const inviteId = invite._id
|
||||
@@ -332,7 +335,7 @@ const CollaboratorsInviteHandler = {
|
||||
return callback(err)
|
||||
}
|
||||
// Remove invite
|
||||
logger.log({ projectId, inviteId }, 'removing invite')
|
||||
logger.debug({ projectId, inviteId }, 'removing invite')
|
||||
return ProjectInvite.deleteOne({ _id: inviteId }, function (err) {
|
||||
if (err != null) {
|
||||
OError.tag(err, 'error removing invite', {
|
||||
|
||||
@@ -220,7 +220,7 @@ const ClsiManager = {
|
||||
)
|
||||
}
|
||||
if (validationProblems != null) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, validationProblems },
|
||||
'problems with users latex before compile was attempted'
|
||||
)
|
||||
@@ -395,7 +395,7 @@ const ClsiManager = {
|
||||
const currentCompileTime = results.currentBackend.finishTime
|
||||
const newBackendCompileTime = results.newBackend.finishTime || 0
|
||||
const timeDifference = newBackendCompileTime - currentCompileTime
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{
|
||||
statusCodeSame,
|
||||
timeDifference,
|
||||
|
||||
@@ -229,7 +229,7 @@ module.exports = CompileController = {
|
||||
logger.err({ err }, 'error checking rate limit for pdf download')
|
||||
return res.sendStatus(500)
|
||||
} else if (!canContinue) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ project_id, ip: req.ip },
|
||||
'rate limit hit downloading pdf'
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports = CooldownManager = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId },
|
||||
`[Cooldown] putting project on cooldown for ${COOLDOWN_IN_SECONDS} seconds`
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = CooldownMiddleware = {
|
||||
return next(err)
|
||||
}
|
||||
if (projectIsOnCooldown) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId },
|
||||
'[Cooldown] project is on cooldown, denying request'
|
||||
)
|
||||
|
||||
@@ -130,7 +130,7 @@ function getDoc(projectId, docId, options, callback) {
|
||||
return callback(error)
|
||||
}
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ docId, projectId, version: doc.version, rev: doc.rev },
|
||||
'got doc from docstore api'
|
||||
)
|
||||
@@ -199,7 +199,10 @@ function updateDoc(projectId, docId, lines, version, ranges, callback) {
|
||||
return callback(error)
|
||||
}
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
logger.log({ projectId, docId }, 'update doc in docstore url finished')
|
||||
logger.debug(
|
||||
{ projectId, docId },
|
||||
'update doc in docstore url finished'
|
||||
)
|
||||
callback(null, result.modified, result.rev)
|
||||
} else {
|
||||
error = new OError(
|
||||
@@ -226,7 +229,7 @@ function destroyProject(projectId, callback) {
|
||||
|
||||
function _operateOnProject(projectId, method, callback) {
|
||||
const url = `${settings.apis.docstore.url}/project/${projectId}/${method}`
|
||||
logger.log({ projectId }, `calling ${method} for project in docstore`)
|
||||
logger.debug({ projectId }, `calling ${method} for project in docstore`)
|
||||
// use default timeout for archiving/unarchiving/destroying
|
||||
request.post(url, (err, res, docs) => {
|
||||
if (err) {
|
||||
|
||||
@@ -102,7 +102,7 @@ function setDocument(req, res, next) {
|
||||
})
|
||||
return next(error)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ docId, projectId },
|
||||
'finished receiving set document request from api (docupdater)'
|
||||
)
|
||||
|
||||
@@ -24,13 +24,13 @@ module.exports = ProjectZipStreamManager = {
|
||||
return cb(error)
|
||||
}
|
||||
if (!project) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId },
|
||||
'cannot append project to zip stream: project not found'
|
||||
)
|
||||
return cb()
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, name: project.name },
|
||||
'appending project to zip stream'
|
||||
)
|
||||
@@ -42,7 +42,10 @@ module.exports = ProjectZipStreamManager = {
|
||||
}
|
||||
archive.append(stream, { name: `${project.name}.zip` })
|
||||
stream.on('end', () => {
|
||||
logger.log({ projectId, name: project.name }, 'zip stream ended')
|
||||
logger.debug(
|
||||
{ projectId, name: project.name },
|
||||
'zip stream ended'
|
||||
)
|
||||
cb()
|
||||
})
|
||||
}
|
||||
@@ -51,7 +54,7 @@ module.exports = ProjectZipStreamManager = {
|
||||
})
|
||||
|
||||
async.series(jobs, () => {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectIds },
|
||||
'finished creating zip stream of multiple projects'
|
||||
)
|
||||
@@ -97,7 +100,7 @@ module.exports = ProjectZipStreamManager = {
|
||||
if (path[0] === '/') {
|
||||
path = path.slice(1)
|
||||
}
|
||||
logger.log({ projectId }, 'Adding doc')
|
||||
logger.debug({ projectId }, 'Adding doc')
|
||||
archive.append(doc.lines.join('\n'), { name: path })
|
||||
setImmediate(cb)
|
||||
})
|
||||
|
||||
@@ -356,7 +356,7 @@ const EditorController = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ project_id, path }, "making directories if they don't exist")
|
||||
logger.debug({ project_id, path }, "making directories if they don't exist")
|
||||
return ProjectEntityUpdateHandler.mkdirp(
|
||||
project_id,
|
||||
path,
|
||||
@@ -402,7 +402,7 @@ const EditorController = {
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ project_id, entity_id, entityType },
|
||||
'telling users entity has been deleted'
|
||||
)
|
||||
@@ -441,7 +441,7 @@ const EditorController = {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
logger.log({ project_id, description }, 'updating project description')
|
||||
logger.debug({ project_id, description }, 'updating project description')
|
||||
return ProjectDetailsHandler.setProjectDescription(
|
||||
project_id,
|
||||
description,
|
||||
|
||||
@@ -25,14 +25,14 @@ function getClient() {
|
||||
if (EMAIL_SETTINGS.parameters) {
|
||||
const emailParameters = EMAIL_SETTINGS.parameters
|
||||
if (emailParameters.AWSAccessKeyID || EMAIL_SETTINGS.driver === 'ses') {
|
||||
logger.log('using aws ses for email')
|
||||
logger.debug('using aws ses for email')
|
||||
client = nodemailer.createTransport(sesTransport(emailParameters))
|
||||
} else if (emailParameters.sendgridApiKey) {
|
||||
throw new OError(
|
||||
'sendgridApiKey configuration option is deprecated, use SMTP instead'
|
||||
)
|
||||
} else if (emailParameters.MandrillApiKey) {
|
||||
logger.log('using mandril for email')
|
||||
logger.debug('using mandril for email')
|
||||
client = nodemailer.createTransport(
|
||||
mandrillTransport({
|
||||
auth: {
|
||||
@@ -41,7 +41,7 @@ function getClient() {
|
||||
})
|
||||
)
|
||||
} else {
|
||||
logger.log('using smtp for email')
|
||||
logger.debug('using smtp for email')
|
||||
const smtp = _.pick(
|
||||
emailParameters,
|
||||
'host',
|
||||
@@ -60,7 +60,7 @@ function getClient() {
|
||||
)
|
||||
client = {
|
||||
async sendMail(options) {
|
||||
logger.log({ options }, 'Would send email if enabled.')
|
||||
logger.debug({ options }, 'Would send email if enabled.')
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ async function sendEmail(options) {
|
||||
try {
|
||||
const canContinue = await checkCanSendEmail(options)
|
||||
if (!canContinue) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{
|
||||
sendingUser_id: options.sendingUser_id,
|
||||
to: options.to,
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = {
|
||||
function (err, export_data) {
|
||||
if (err != null) {
|
||||
if (err.forwardResponse != null) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ responseError: err.forwardResponse },
|
||||
'forwarding response'
|
||||
)
|
||||
@@ -64,7 +64,7 @@ module.exports = {
|
||||
return next(err)
|
||||
}
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{
|
||||
user_id,
|
||||
project_id,
|
||||
|
||||
@@ -30,7 +30,7 @@ const FileStoreHandler = {
|
||||
return callback(new Error('error getting stat, not available'))
|
||||
}
|
||||
if (!stat.isFile()) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, fileArgs, fsPath },
|
||||
'tried to upload symlink, not continuing'
|
||||
)
|
||||
@@ -162,7 +162,7 @@ const FileStoreHandler = {
|
||||
},
|
||||
|
||||
deleteFile(projectId, fileId, callback) {
|
||||
logger.log({ projectId, fileId }, 'telling file store to delete file')
|
||||
logger.debug({ projectId, fileId }, 'telling file store to delete file')
|
||||
const opts = {
|
||||
method: 'delete',
|
||||
uri: this._buildUrl(projectId, fileId),
|
||||
@@ -202,7 +202,7 @@ const FileStoreHandler = {
|
||||
},
|
||||
|
||||
copyFile(oldProjectId, oldFileId, newProjectId, newFileId, callback) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ oldProjectId, oldFileId, newProjectId, newFileId },
|
||||
'telling filestore to copy a file'
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = InactiveProjectManager = {
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ project_id, active: project.active },
|
||||
'seeing if need to reactivate project'
|
||||
)
|
||||
@@ -94,7 +94,7 @@ module.exports = InactiveProjectManager = {
|
||||
}
|
||||
)
|
||||
)
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ numberOfProjects: projects && projects.length },
|
||||
'deactivating projects'
|
||||
)
|
||||
@@ -108,7 +108,7 @@ module.exports = InactiveProjectManager = {
|
||||
},
|
||||
|
||||
deactivateProject(project_id, callback) {
|
||||
logger.log({ project_id }, 'deactivating inactive project')
|
||||
logger.debug({ project_id }, 'deactivating inactive project')
|
||||
const jobs = [
|
||||
cb => DocstoreManager.archiveProject(project_id, cb),
|
||||
cb => ProjectUpdateHandler.markAsInactive(project_id, cb),
|
||||
|
||||
@@ -20,7 +20,7 @@ const logger = require('@overleaf/logger')
|
||||
module.exports = MetaController = {
|
||||
getMetadata(req, res, next) {
|
||||
const { project_id } = req.params
|
||||
logger.log({ project_id }, 'getting all labels for project')
|
||||
logger.debug({ project_id }, 'getting all labels for project')
|
||||
return MetaHandler.getAllMetaForProject(
|
||||
project_id,
|
||||
function (err, projectMeta) {
|
||||
@@ -43,7 +43,7 @@ module.exports = MetaController = {
|
||||
const { project_id } = req.params
|
||||
const { doc_id } = req.params
|
||||
const { broadcast } = req.body
|
||||
logger.log({ project_id, doc_id, broadcast }, 'getting labels for doc')
|
||||
logger.debug({ project_id, doc_id, broadcast }, 'getting labels for doc')
|
||||
return MetaHandler.getMetaForDoc(
|
||||
project_id,
|
||||
doc_id,
|
||||
|
||||
@@ -23,10 +23,10 @@ class NonFatalEmailUpdateError extends OError {
|
||||
|
||||
function getProvider() {
|
||||
if (mailchimpIsConfigured()) {
|
||||
logger.info('Using newsletter provider: mailchimp')
|
||||
logger.debug('Using newsletter provider: mailchimp')
|
||||
return makeMailchimpProvider()
|
||||
} else {
|
||||
logger.info('Using newsletter provider: none')
|
||||
logger.debug('Using newsletter provider: none')
|
||||
return makeNullProvider()
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ function makeMailchimpProvider() {
|
||||
status_if_new: 'subscribed',
|
||||
merge_fields: getMergeFields(user),
|
||||
})
|
||||
logger.info({ user }, 'finished subscribing user to newsletter')
|
||||
logger.debug({ user }, 'finished subscribing user to newsletter')
|
||||
} catch (err) {
|
||||
throw OError.tag(err, 'error subscribing user to newsletter', {
|
||||
userId: user._id,
|
||||
@@ -89,7 +89,7 @@ function makeMailchimpProvider() {
|
||||
merge_fields: getMergeFields(user),
|
||||
})
|
||||
}
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ user, options },
|
||||
'finished unsubscribing user from newsletter'
|
||||
)
|
||||
@@ -100,7 +100,7 @@ function makeMailchimpProvider() {
|
||||
}
|
||||
|
||||
if (err.message.includes('looks fake or invalid')) {
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ err, user, options },
|
||||
'Mailchimp declined to unsubscribe user because it finds the email looks fake'
|
||||
)
|
||||
@@ -121,7 +121,7 @@ function makeMailchimpProvider() {
|
||||
} catch (updateError) {
|
||||
// if we failed to update the user, delete their old email address so that
|
||||
// we don't leave it stuck in mailchimp
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ oldEmail, newEmail, updateError },
|
||||
'unable to change email in newsletter, removing old mail'
|
||||
)
|
||||
@@ -161,7 +161,7 @@ function makeMailchimpProvider() {
|
||||
email_address: newEmail,
|
||||
merge_fields: getMergeFields(user),
|
||||
})
|
||||
logger.info('finished changing email in the newsletter')
|
||||
logger.debug('finished changing email in the newsletter')
|
||||
} catch (err) {
|
||||
// silently ignore users who were never subscribed
|
||||
if (err.status === 404) {
|
||||
@@ -173,7 +173,7 @@ function makeMailchimpProvider() {
|
||||
if (err.message.includes(key)) {
|
||||
const message = `unable to change email in newsletter, ${errors[key]}`
|
||||
|
||||
logger.info({ oldEmail, newEmail }, message)
|
||||
logger.debug({ oldEmail, newEmail }, message)
|
||||
|
||||
throw new NonFatalEmailUpdateError(
|
||||
message,
|
||||
@@ -218,7 +218,7 @@ function makeNullProvider() {
|
||||
}
|
||||
|
||||
async function subscribed(user) {
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ user },
|
||||
'Not checking user because no newsletter provider is configured'
|
||||
)
|
||||
@@ -226,21 +226,21 @@ function makeNullProvider() {
|
||||
}
|
||||
|
||||
async function subscribe(user) {
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ user },
|
||||
'Not subscribing user to newsletter because no newsletter provider is configured'
|
||||
)
|
||||
}
|
||||
|
||||
async function unsubscribe(user) {
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ user },
|
||||
'Not unsubscribing user from newsletter because no newsletter provider is configured'
|
||||
)
|
||||
}
|
||||
|
||||
async function changeEmail(oldEmail, newEmail) {
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ oldEmail, newEmail },
|
||||
'Not changing email in newsletter for user because no newsletter provider is configured'
|
||||
)
|
||||
|
||||
@@ -247,7 +247,7 @@ const ProjectController = {
|
||||
metrics.inc('cloned-project')
|
||||
const projectId = req.params.Project_id
|
||||
const { projectName } = req.body
|
||||
logger.log({ projectId, projectName }, 'cloning project')
|
||||
logger.debug({ projectId, projectName }, 'cloning project')
|
||||
if (!SessionManager.isUserLoggedIn(req.session)) {
|
||||
return res.json({ redir: '/register' })
|
||||
}
|
||||
@@ -743,7 +743,7 @@ const ProjectController = {
|
||||
if (err) {
|
||||
return cb(err)
|
||||
}
|
||||
logger.log({ projectId, userId }, 'got user')
|
||||
logger.debug({ projectId, userId }, 'got user')
|
||||
if (FeaturesUpdater.featuresEpochIsCurrent(user)) {
|
||||
return cb(null, user)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
async function markAsDeletedByExternalSource(projectId) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ project_id: projectId },
|
||||
'marking project as deleted by external data source'
|
||||
)
|
||||
@@ -277,7 +277,7 @@ async function deleteProject(projectId, options = {}) {
|
||||
throw err
|
||||
}
|
||||
|
||||
logger.log({ project_id: projectId }, 'successfully deleted project')
|
||||
logger.debug({ project_id: projectId }, 'successfully deleted project')
|
||||
}
|
||||
|
||||
async function undeleteProject(projectId, options = {}) {
|
||||
|
||||
@@ -85,7 +85,7 @@ async function getProjectDescription(projectId) {
|
||||
async function setProjectDescription(projectId, description) {
|
||||
const conditions = { _id: projectId }
|
||||
const update = { description }
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ conditions, update, projectId, description },
|
||||
'setting project description'
|
||||
)
|
||||
@@ -99,7 +99,7 @@ async function setProjectDescription(projectId, description) {
|
||||
async function renameProject(projectId, newName) {
|
||||
newName = newName.trim()
|
||||
await validateProjectName(newName)
|
||||
logger.log({ projectId, newName }, 'renaming project')
|
||||
logger.debug({ projectId, newName }, 'renaming project')
|
||||
let project
|
||||
try {
|
||||
project = await ProjectGetter.promises.getProject(projectId, { name: true })
|
||||
|
||||
@@ -117,7 +117,7 @@ function getDocContext(projectId, docId, callback) {
|
||||
// 3. web triggers (soft)-delete in docstore
|
||||
// Specifically when an update comes in after 1
|
||||
// and before 3 completes.
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{ projectId, docId },
|
||||
'updating doc that is in process of getting soft-deleted'
|
||||
)
|
||||
@@ -174,7 +174,10 @@ const ProjectEntityUpdateHandler = {
|
||||
return callback(err)
|
||||
}
|
||||
const { projectName, isDeletedDoc, path } = ctx
|
||||
logger.log({ projectId, docId }, 'telling docstore manager to update doc')
|
||||
logger.debug(
|
||||
{ projectId, docId },
|
||||
'telling docstore manager to update doc'
|
||||
)
|
||||
DocstoreManager.updateDoc(
|
||||
projectId,
|
||||
docId,
|
||||
@@ -189,7 +192,7 @@ const ProjectEntityUpdateHandler = {
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, docId, modified },
|
||||
'finished updating doc lines'
|
||||
)
|
||||
@@ -219,7 +222,7 @@ const ProjectEntityUpdateHandler = {
|
||||
},
|
||||
|
||||
setRootDoc(projectId, newRootDocID, callback) {
|
||||
logger.log({ projectId, rootDocId: newRootDocID }, 'setting root doc')
|
||||
logger.debug({ projectId, rootDocId: newRootDocID }, 'setting root doc')
|
||||
if (projectId == null || newRootDocID == null) {
|
||||
return callback(
|
||||
new Errors.InvalidError('missing arguments (project or doc)')
|
||||
@@ -251,7 +254,7 @@ const ProjectEntityUpdateHandler = {
|
||||
},
|
||||
|
||||
unsetRootDoc(projectId, callback) {
|
||||
logger.log({ projectId }, 'removing root doc')
|
||||
logger.debug({ projectId }, 'removing root doc')
|
||||
Project.updateOne(
|
||||
{ _id: projectId },
|
||||
{ $unset: { rootDoc_id: true } },
|
||||
@@ -758,7 +761,7 @@ const ProjectEntityUpdateHandler = {
|
||||
if (err != null) {
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, docId: existingDoc._id },
|
||||
'notifying users that the document has been updated'
|
||||
)
|
||||
@@ -1109,7 +1112,7 @@ const ProjectEntityUpdateHandler = {
|
||||
userId,
|
||||
callback
|
||||
) {
|
||||
logger.log({ entityId, entityType, projectId }, 'deleting project entity')
|
||||
logger.debug({ entityId, entityType, projectId }, 'deleting project entity')
|
||||
if (entityType == null) {
|
||||
logger.warn({ err: 'No entityType set', projectId, entityId })
|
||||
return callback(new Error('No entityType set'))
|
||||
@@ -1227,7 +1230,7 @@ const ProjectEntityUpdateHandler = {
|
||||
userId,
|
||||
callback
|
||||
) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ entityType, entityId, projectId, destFolderId },
|
||||
'moving entity'
|
||||
)
|
||||
@@ -1283,7 +1286,7 @@ const ProjectEntityUpdateHandler = {
|
||||
if (!SafePath.isCleanFilename(newName)) {
|
||||
return callback(new Errors.InvalidNameError('invalid element name'))
|
||||
}
|
||||
logger.log({ entityId, projectId }, `renaming ${entityType}`)
|
||||
logger.debug({ entityId, projectId }, `renaming ${entityType}`)
|
||||
if (entityType == null) {
|
||||
logger.warn({ err: 'No entityType set', projectId, entityId })
|
||||
return callback(new Error('No entityType set'))
|
||||
|
||||
@@ -29,7 +29,7 @@ const oneMinInMs = 60 * 1000
|
||||
const fiveMinsInMs = oneMinInMs * 5
|
||||
|
||||
if (!Features.hasFeature('references')) {
|
||||
logger.log('references search not enabled')
|
||||
logger.debug('references search not enabled')
|
||||
}
|
||||
|
||||
module.exports = ReferencesHandler = {
|
||||
@@ -117,7 +117,7 @@ module.exports = ReferencesHandler = {
|
||||
new Errors.NotFoundError(`project does not exist: ${projectId}`)
|
||||
)
|
||||
}
|
||||
logger.log({ projectId }, 'indexing all bib files in project')
|
||||
logger.debug({ projectId }, 'indexing all bib files in project')
|
||||
const docIds = ReferencesHandler._findBibDocIds(project)
|
||||
const fileIds = ReferencesHandler._findBibFileIds(project)
|
||||
return ReferencesHandler._doIndexOperation(
|
||||
@@ -172,7 +172,7 @@ module.exports = ReferencesHandler = {
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ projectId, docIds },
|
||||
'flushing docs to mongo before calling references service'
|
||||
)
|
||||
@@ -213,7 +213,7 @@ module.exports = ReferencesHandler = {
|
||||
return callback(err)
|
||||
}
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
logger.log({ projectId }, 'got keys from references api')
|
||||
logger.debug({ projectId }, 'got keys from references api')
|
||||
return callback(null, data)
|
||||
} else {
|
||||
err = new Error(
|
||||
|
||||
@@ -127,10 +127,10 @@ const AdminController = {
|
||||
},
|
||||
|
||||
writeAllToMongo(req, res) {
|
||||
logger.log('writing all docs to mongo')
|
||||
logger.debug('writing all docs to mongo')
|
||||
Settings.mongo.writeAll = true
|
||||
return DocumentUpdaterHandler.flushAllDocsToMongo(function () {
|
||||
logger.log('all docs have been saved to mongo')
|
||||
logger.debug('all docs have been saved to mongo')
|
||||
return res.sendStatus(200)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = {
|
||||
if (!languageCodeIsSupported(language)) {
|
||||
// this log statement can be changed to 'error' once projects with
|
||||
// unsupported languages are removed from the DB
|
||||
logger.info({ language }, 'language not supported')
|
||||
logger.debug({ language }, 'language not supported')
|
||||
return res.status(422).json({ misspellings: [] })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ async function refreshFeatures(userId, reason) {
|
||||
})
|
||||
const oldFeatures = _.clone(user.features)
|
||||
const features = await computeFeatures(userId)
|
||||
logger.log({ userId, features }, 'updating user features')
|
||||
logger.debug({ userId, features }, 'updating user features')
|
||||
|
||||
const matchedFeatureSet = FeaturesHelper.getMatchedFeatureSet(features)
|
||||
AnalyticsManager.setUserPropertyForUser(
|
||||
@@ -51,7 +51,7 @@ async function refreshFeatures(userId, reason) {
|
||||
const { features: newFeatures, featuresChanged } =
|
||||
await UserFeaturesUpdater.promises.updateFeatures(userId, features)
|
||||
if (oldFeatures.dropbox === true && features.dropbox === false) {
|
||||
logger.log({ userId }, '[FeaturesUpdater] must unlink dropbox')
|
||||
logger.debug({ userId }, '[FeaturesUpdater] must unlink dropbox')
|
||||
const Modules = require('../../infrastructure/Modules')
|
||||
try {
|
||||
await Modules.promises.hooks.fire('removeDropbox', userId, reason)
|
||||
@@ -77,7 +77,7 @@ async function computeFeatures(userId) {
|
||||
const v1Features = await _getV1Features(user)
|
||||
const bonusFeatures = await ReferalFeatures.promises.getBonusFeatures(userId)
|
||||
const featuresOverrides = await _getFeaturesOverrides(user)
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{
|
||||
userId,
|
||||
individualFeatures,
|
||||
@@ -161,7 +161,7 @@ function _planCodeToFeatures(planCode) {
|
||||
}
|
||||
|
||||
async function doSyncFromV1(v1UserId) {
|
||||
logger.log({ v1UserId }, '[AccountSync] starting account sync')
|
||||
logger.debug({ v1UserId }, '[AccountSync] starting account sync')
|
||||
const user = await UserGetter.promises.getUser(
|
||||
{ 'overleaf.id': v1UserId },
|
||||
{ _id: 1 }
|
||||
@@ -170,7 +170,7 @@ async function doSyncFromV1(v1UserId) {
|
||||
logger.warn({ v1UserId }, '[AccountSync] no user found for v1 id')
|
||||
return
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ v1UserId, userId: user._id },
|
||||
'[AccountSync] updating user subscription and features'
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ async function createAccountForUserId(userId) {
|
||||
lastName: user.last_name,
|
||||
}
|
||||
const account = await client.createAccount(accountCreate)
|
||||
logger.log({ userId, account }, 'created recurly account')
|
||||
logger.debug({ userId, account }, 'created recurly account')
|
||||
return account
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ async function getSubscription(subscriptionId) {
|
||||
|
||||
async function changeSubscription(subscriptionId, body) {
|
||||
const change = await client.createSubscriptionChange(subscriptionId, body)
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId, changeId: change.id },
|
||||
'created subscription change'
|
||||
)
|
||||
@@ -59,7 +59,7 @@ async function changeSubscriptionByUuid(subscriptionUuid, ...args) {
|
||||
|
||||
async function removeSubscriptionChange(subscriptionId) {
|
||||
const removed = await client.removeSubscriptionChange(subscriptionId)
|
||||
logger.log({ subscriptionId }, 'removed pending subscription change')
|
||||
logger.debug({ subscriptionId }, 'removed pending subscription change')
|
||||
return removed
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ async function cancelSubscriptionByUuid(subscriptionUuid) {
|
||||
if (
|
||||
err.message === 'Only active and future subscriptions can be canceled.'
|
||||
) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionUuid },
|
||||
'subscription cancellation failed, subscription not active'
|
||||
)
|
||||
|
||||
@@ -62,7 +62,7 @@ const RecurlyWrapper = {
|
||||
checkAccountExists(cache, next) {
|
||||
const { user } = cache
|
||||
const { subscriptionDetails } = cache
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'checking if recurly account exists for user'
|
||||
)
|
||||
@@ -85,14 +85,17 @@ const RecurlyWrapper = {
|
||||
}
|
||||
if (response.statusCode === 404) {
|
||||
// actually not an error in this case, just no existing account
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'user does not currently exist in recurly, proceed'
|
||||
)
|
||||
cache.userExists = false
|
||||
return next(null, cache)
|
||||
}
|
||||
logger.log({ user_id: user._id }, 'user appears to exist in recurly')
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'user appears to exist in recurly'
|
||||
)
|
||||
return RecurlyWrapper._parseAccountXml(
|
||||
responseBody,
|
||||
function (err, account) {
|
||||
@@ -176,7 +179,7 @@ const RecurlyWrapper = {
|
||||
const { user } = cache
|
||||
const { recurlyTokenIds } = cache
|
||||
const { subscriptionDetails } = cache
|
||||
logger.log({ user_id: user._id }, 'creating billing info in recurly')
|
||||
logger.debug({ user_id: user._id }, 'creating billing info in recurly')
|
||||
const accountCode = __guard__(
|
||||
cache != null ? cache.account : undefined,
|
||||
x1 => x1.account_code
|
||||
@@ -231,7 +234,7 @@ const RecurlyWrapper = {
|
||||
setAddressAndCompanyBillingInfo(cache, next) {
|
||||
const { user } = cache
|
||||
const { subscriptionDetails } = cache
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'setting billing address and company info in recurly'
|
||||
)
|
||||
@@ -303,7 +306,7 @@ const RecurlyWrapper = {
|
||||
createSubscription(cache, next) {
|
||||
const { user } = cache
|
||||
const { subscriptionDetails } = cache
|
||||
logger.log({ user_id: user._id }, 'creating subscription in recurly')
|
||||
logger.debug({ user_id: user._id }, 'creating subscription in recurly')
|
||||
const data = {
|
||||
plan_code: subscriptionDetails.plan_code,
|
||||
currency: subscriptionDetails.currencyCode,
|
||||
@@ -367,7 +370,7 @@ const RecurlyWrapper = {
|
||||
recurlyTokenIds,
|
||||
callback
|
||||
) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'starting process of creating paypal subscription'
|
||||
)
|
||||
@@ -397,7 +400,7 @@ const RecurlyWrapper = {
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'done creating paypal subscription for user'
|
||||
)
|
||||
@@ -467,7 +470,7 @@ const RecurlyWrapper = {
|
||||
|
||||
createSubscription(user, subscriptionDetails, recurlyTokenIds, callback) {
|
||||
const { isPaypal } = subscriptionDetails
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id, isPaypal },
|
||||
'setting up subscription in recurly'
|
||||
)
|
||||
@@ -615,7 +618,7 @@ const RecurlyWrapper = {
|
||||
}
|
||||
const items = data[resource]
|
||||
allItems = allItems.concat(items)
|
||||
logger.log(
|
||||
logger.debug(
|
||||
`got another ${items.length}, total now ${allItems.length}`
|
||||
)
|
||||
cursor = __guard__(
|
||||
@@ -736,7 +739,7 @@ const RecurlyWrapper = {
|
||||
},
|
||||
|
||||
updateSubscription(subscriptionId, options, callback) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId, options },
|
||||
'telling recurly to update subscription'
|
||||
)
|
||||
@@ -796,7 +799,7 @@ const RecurlyWrapper = {
|
||||
)
|
||||
}
|
||||
|
||||
logger.log({ coupon_code, requestBody }, 'creating coupon')
|
||||
logger.debug({ coupon_code, requestBody }, 'creating coupon')
|
||||
return RecurlyWrapper.apiRequest(
|
||||
{
|
||||
url: 'coupons',
|
||||
@@ -840,7 +843,7 @@ const RecurlyWrapper = {
|
||||
)
|
||||
}
|
||||
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ account_code, coupon_code, requestBody },
|
||||
'redeeming coupon for user'
|
||||
)
|
||||
@@ -868,7 +871,7 @@ const RecurlyWrapper = {
|
||||
}
|
||||
const next_renewal_date = new Date()
|
||||
next_renewal_date.setDate(next_renewal_date.getDate() + daysUntilExpire)
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId, daysUntilExpire },
|
||||
'Exending Free trial for user'
|
||||
)
|
||||
|
||||
@@ -285,7 +285,7 @@ function successfulSubscription(req, res, next) {
|
||||
|
||||
function cancelSubscription(req, res, next) {
|
||||
const user = SessionManager.getSessionUser(req.session)
|
||||
logger.log({ user_id: user._id }, 'canceling subscription')
|
||||
logger.debug({ user_id: user._id }, 'canceling subscription')
|
||||
SubscriptionHandler.cancelSubscription(user, function (err) {
|
||||
if (err) {
|
||||
OError.tag(err, 'something went wrong canceling subscription', {
|
||||
@@ -307,7 +307,7 @@ function canceledSubscription(req, res, next) {
|
||||
|
||||
function cancelV1Subscription(req, res, next) {
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
logger.log({ userId }, 'canceling v1 subscription')
|
||||
logger.debug({ userId }, 'canceling v1 subscription')
|
||||
V1SubscriptionManager.cancelV1Subscription(userId, function (err) {
|
||||
if (err) {
|
||||
OError.tag(err, 'something went wrong canceling v1 subscription', {
|
||||
@@ -331,7 +331,7 @@ function updateSubscription(req, res, next) {
|
||||
)
|
||||
return next(err)
|
||||
}
|
||||
logger.log({ planCode, user_id: user._id }, 'updating subscription')
|
||||
logger.debug({ planCode, user_id: user._id }, 'updating subscription')
|
||||
SubscriptionHandler.updateSubscription(user, planCode, null, function (err) {
|
||||
if (err) {
|
||||
OError.tag(err, 'something went wrong updating subscription', {
|
||||
@@ -345,7 +345,7 @@ function updateSubscription(req, res, next) {
|
||||
|
||||
function cancelPendingSubscriptionChange(req, res, next) {
|
||||
const user = SessionManager.getSessionUser(req.session)
|
||||
logger.log({ user_id: user._id }, 'canceling pending subscription change')
|
||||
logger.debug({ user_id: user._id }, 'canceling pending subscription change')
|
||||
SubscriptionHandler.cancelPendingSubscriptionChange(user, function (err) {
|
||||
if (err) {
|
||||
OError.tag(
|
||||
@@ -377,7 +377,7 @@ function updateAccountEmailAddress(req, res, next) {
|
||||
|
||||
function reactivateSubscription(req, res, next) {
|
||||
const user = SessionManager.getSessionUser(req.session)
|
||||
logger.log({ user_id: user._id }, 'reactivating subscription')
|
||||
logger.debug({ user_id: user._id }, 'reactivating subscription')
|
||||
SubscriptionHandler.reactivateSubscription(user, function (err) {
|
||||
if (err) {
|
||||
OError.tag(err, 'something went wrong reactivating subscription', {
|
||||
@@ -390,7 +390,7 @@ function reactivateSubscription(req, res, next) {
|
||||
}
|
||||
|
||||
function recurlyCallback(req, res, next) {
|
||||
logger.log({ data: req.body }, 'received recurly callback')
|
||||
logger.debug({ data: req.body }, 'received recurly callback')
|
||||
const event = Object.keys(req.body)[0]
|
||||
const eventData = req.body[event]
|
||||
|
||||
@@ -473,7 +473,7 @@ function processUpgradeToAnnualPlan(req, res, next) {
|
||||
const { planName } = req.body
|
||||
const couponCode = Settings.coupon_codes.upgradeToAnnualPromo[planName]
|
||||
const annualPlanName = `${planName}-annual`
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id, planName: annualPlanName },
|
||||
'user is upgrading to annual billing with discount'
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ const SessionManager = require('../Authentication/SessionManager')
|
||||
function removeUserFromGroup(req, res, next) {
|
||||
const subscription = req.entity
|
||||
const userToRemoveId = req.params.user_id
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId: subscription._id, userToRemove_id: userToRemoveId },
|
||||
'removing user from group subscription'
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ const SubscriptionLocator = {
|
||||
getUsersSubscription(user_or_id, callback) {
|
||||
const user_id = SubscriptionLocator._getUserId(user_or_id)
|
||||
Subscription.findOne({ admin_id: user_id }, function (err, subscription) {
|
||||
logger.log({ user_id }, 'got users subscription')
|
||||
logger.debug({ user_id }, 'got users subscription')
|
||||
callback(err, subscription)
|
||||
})
|
||||
},
|
||||
@@ -30,7 +30,7 @@ const SubscriptionLocator = {
|
||||
Subscription.findOne(
|
||||
{ admin_id: user_id, groupPlan: false },
|
||||
function (err, subscription) {
|
||||
logger.log({ user_id }, 'got users individual subscription')
|
||||
logger.debug({ user_id }, 'got users individual subscription')
|
||||
callback(err, subscription)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -233,7 +233,7 @@ const removeLegacyInvite = (subscriptionId, email, callback) =>
|
||||
|
||||
function checkIfInviteIsPossible(subscription, email, callback) {
|
||||
if (!subscription.groupPlan) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId: subscription.id },
|
||||
'can not add members to a subscription that is not in a group plan'
|
||||
)
|
||||
@@ -241,7 +241,7 @@ function checkIfInviteIsPossible(subscription, email, callback) {
|
||||
}
|
||||
|
||||
if (LimitationsManager.teamHasReachedMemberLimit(subscription)) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId: subscription.id },
|
||||
'team has reached member limit'
|
||||
)
|
||||
@@ -261,7 +261,7 @@ function checkIfInviteIsPossible(subscription, email, callback) {
|
||||
)
|
||||
|
||||
if (existingMember) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ subscriptionId: subscription.id, email },
|
||||
'user already in team'
|
||||
)
|
||||
|
||||
@@ -212,7 +212,7 @@ module.exports = UpdateMerger = {
|
||||
)
|
||||
return callback(err)
|
||||
}
|
||||
logger.log({ docLines }, 'processing doc update from tpds')
|
||||
logger.debug({ docLines }, 'processing doc update from tpds')
|
||||
return EditorController.upsertDocWithPath(
|
||||
project_id,
|
||||
path,
|
||||
|
||||
@@ -147,7 +147,7 @@ async function checkAndGetProjectOrResponseAction(
|
||||
if (isAnonymousUser && tokenAccessEnabled) {
|
||||
if (tokenType === TokenAccessHandler.TOKEN_TYPES.READ_AND_WRITE) {
|
||||
if (TokenAccessHandler.ANONYMOUS_READ_AND_WRITE_ENABLED) {
|
||||
logger.info({ projectId }, 'granting read-write anonymous access')
|
||||
logger.debug({ projectId }, 'granting read-write anonymous access')
|
||||
TokenAccessHandler.grantSessionTokenAccess(req, projectId, token)
|
||||
return [
|
||||
null,
|
||||
@@ -178,7 +178,7 @@ async function checkAndGetProjectOrResponseAction(
|
||||
]
|
||||
}
|
||||
} else if (tokenType === TokenAccessHandler.TOKEN_TYPES.READ_ONLY) {
|
||||
logger.info({ projectId }, 'granting read-only anonymous access')
|
||||
logger.debug({ projectId }, 'granting read-only anonymous access')
|
||||
TokenAccessHandler.grantSessionTokenAccess(req, projectId, token)
|
||||
return [
|
||||
null,
|
||||
|
||||
@@ -219,7 +219,7 @@ const ArchiveManager = {
|
||||
}
|
||||
|
||||
const timer = new metrics.Timer('unzipDirectory')
|
||||
logger.log({ source, destination }, 'unzipping file')
|
||||
logger.debug({ source, destination }, 'unzipping file')
|
||||
|
||||
return ArchiveManager._extractZipFiles(
|
||||
source,
|
||||
|
||||
@@ -86,7 +86,7 @@ async function addFolderContents(
|
||||
replace
|
||||
) {
|
||||
if (!(await _isSafeOnFileSystem(folderPath))) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ userId, projectId, parentFolderId, folderPath },
|
||||
'add folder contents is from symlink, stopping insert'
|
||||
)
|
||||
@@ -110,7 +110,7 @@ async function addFolderContents(
|
||||
|
||||
async function addEntity(userId, projectId, folderId, name, fsPath, replace) {
|
||||
if (!(await _isSafeOnFileSystem(fsPath))) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ userId, projectId, folderId, fsPath },
|
||||
'add entry is from symlink, stopping insert'
|
||||
)
|
||||
|
||||
@@ -428,7 +428,7 @@ const UserController = {
|
||||
doLogout(req, cb) {
|
||||
metrics.inc('user.logout')
|
||||
const user = SessionManager.getSessionUser(req.session)
|
||||
logger.log({ user }, 'logging out')
|
||||
logger.debug({ user }, 'logging out')
|
||||
const sessionId = req.sessionID
|
||||
if (typeof req.logout === 'function') {
|
||||
req.logout()
|
||||
|
||||
@@ -37,7 +37,7 @@ async function deleteUser(userId, options = {}) {
|
||||
|
||||
try {
|
||||
const user = await User.findById(userId).exec()
|
||||
logger.log({ user }, 'deleting user')
|
||||
logger.debug({ user }, 'deleting user')
|
||||
|
||||
await ensureCanDeleteUser(user)
|
||||
await _cleanupUser(user)
|
||||
|
||||
@@ -197,7 +197,7 @@ const UserPagesController = {
|
||||
|
||||
sessionsPage(req, res, next) {
|
||||
const user = SessionManager.getSessionUser(req.session)
|
||||
logger.log({ userId: user._id }, 'loading sessions page')
|
||||
logger.debug({ userId: user._id }, 'loading sessions page')
|
||||
const currentSession = {
|
||||
ip_address: user.ip_address,
|
||||
session_created: user.session_created,
|
||||
|
||||
@@ -106,7 +106,10 @@ const UserRegistrationHandler = {
|
||||
}
|
||||
|
||||
if (error && error.message === 'EmailAlreadyRegistered') {
|
||||
logger.log({ email }, 'user already exists, resending welcome email')
|
||||
logger.debug(
|
||||
{ email },
|
||||
'user already exists, resending welcome email'
|
||||
)
|
||||
}
|
||||
|
||||
const ONE_WEEK = 7 * 24 * 60 * 60 // seconds
|
||||
|
||||
@@ -88,7 +88,10 @@ const UserSessionsManager = {
|
||||
}
|
||||
sessionKeys = _.filter(sessionKeys, k => !_.contains(exclude, k))
|
||||
if (sessionKeys.length === 0) {
|
||||
logger.log({ user_id: user._id }, 'no other sessions found, returning')
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'no other sessions found, returning'
|
||||
)
|
||||
return callback(null, [])
|
||||
}
|
||||
|
||||
@@ -148,13 +151,13 @@ const UserSessionsManager = {
|
||||
k => !Array.from(retain).includes(k)
|
||||
)
|
||||
if (keysToDelete.length === 0) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id },
|
||||
'no sessions in UserSessions set to delete, returning'
|
||||
)
|
||||
return callback(null)
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: user._id, count: keysToDelete.length },
|
||||
'deleting sessions for user'
|
||||
)
|
||||
|
||||
@@ -231,7 +231,7 @@ async function confirmEmail(userId, email) {
|
||||
if (email == null) {
|
||||
throw new Error('invalid email')
|
||||
}
|
||||
logger.log({ userId, email }, 'confirming user email')
|
||||
logger.debug({ userId, email }, 'confirming user email')
|
||||
|
||||
try {
|
||||
await InstitutionsAPI.promises.addAffiliation(userId, email, {
|
||||
|
||||
@@ -37,7 +37,7 @@ module.exports = V1Handler = {
|
||||
if ([200, 403].includes(response.statusCode)) {
|
||||
const isValid = body.valid
|
||||
const userProfile = body.user_profile
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{
|
||||
email,
|
||||
isValid,
|
||||
@@ -78,7 +78,7 @@ module.exports = V1Handler = {
|
||||
return callback(err, false)
|
||||
}
|
||||
if ([200].includes(response.statusCode)) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ v1_user_id, changed: true },
|
||||
'got success response from v1 password reset api'
|
||||
)
|
||||
|
||||
@@ -112,7 +112,7 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
|
||||
const cdnBlocked = req.query.nocdn === 'true' || req.session.cdnBlocked
|
||||
const userId = SessionManager.getLoggedInUserId(req.session)
|
||||
if (cdnBlocked && req.session.cdnBlocked == null) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ user_id: userId, ip: req != null ? req.ip : undefined },
|
||||
'cdnBlocked for user, not using it and turning it off for future requets'
|
||||
)
|
||||
|
||||
@@ -153,7 +153,7 @@ const FileWriter = {
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ identifier, fsPath },
|
||||
'[writeStreamToDisk] write stream finished'
|
||||
)
|
||||
|
||||
@@ -68,7 +68,7 @@ function getDetails(ip, callback) {
|
||||
timeout: 1000,
|
||||
json: true,
|
||||
}
|
||||
logger.log({ ip, opts }, 'getting geo ip details')
|
||||
logger.debug({ ip, opts }, 'getting geo ip details')
|
||||
request.get(opts, function (err, res, ipDetails) {
|
||||
if (err) {
|
||||
logger.warn({ err, ip }, 'error getting ip details')
|
||||
@@ -91,7 +91,7 @@ function getCurrencyCode(ip, callback) {
|
||||
? ipDetails.country_code.toUpperCase()
|
||||
: undefined
|
||||
const currencyCode = currencyMappings[countryCode] || 'USD'
|
||||
logger.log({ ip, currencyCode, ipDetails }, 'got currencyCode for ip')
|
||||
logger.debug({ ip, currencyCode, ipDetails }, 'got currencyCode for ip')
|
||||
callback(err, currencyCode, countryCode)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ let COUNT = 0
|
||||
|
||||
const LOCK_QUEUES = new Map() // queue lock requests for each name/id so they get the lock on a first-come first-served basis
|
||||
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ lockManagerSettings: settings.lockManager },
|
||||
'LockManager initialising'
|
||||
)
|
||||
@@ -60,7 +60,7 @@ const LockManager = {
|
||||
// is designed to log if this happens.
|
||||
function countIfExceededLockTimeout() {
|
||||
metrics.inc(`lock.${namespace}.exceeded_lock_timeout`)
|
||||
logger.log('exceeded lock timeout', {
|
||||
logger.debug('exceeded lock timeout', {
|
||||
namespace,
|
||||
id,
|
||||
slowExecutionError,
|
||||
@@ -77,7 +77,7 @@ const LockManager = {
|
||||
|
||||
const timeTaken = new Date() - timer.start
|
||||
if (timeTaken > LockManager.SLOW_EXECUTION_THRESHOLD) {
|
||||
logger.log('slow execution during lock', {
|
||||
logger.debug('slow execution during lock', {
|
||||
namespace,
|
||||
id,
|
||||
timeTaken,
|
||||
@@ -113,7 +113,7 @@ const LockManager = {
|
||||
callback(err, true, lockValue)
|
||||
} else {
|
||||
metrics.inc(`lock.${namespace}.try.failed`)
|
||||
logger.log({ key, redis_response: gotLock }, 'lock is locked')
|
||||
logger.debug({ key, redis_response: gotLock }, 'lock is locked')
|
||||
callback(err, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ const connectionPromise = mongoose.connect(
|
||||
)
|
||||
|
||||
mongoose.connection.on('connected', () =>
|
||||
logger.log('mongoose default connection open')
|
||||
logger.debug('mongoose default connection open')
|
||||
)
|
||||
|
||||
mongoose.connection.on('error', err =>
|
||||
@@ -35,7 +35,7 @@ mongoose.connection.on('error', err =>
|
||||
)
|
||||
|
||||
mongoose.connection.on('disconnected', () =>
|
||||
logger.log('mongoose default connection disconnected')
|
||||
logger.debug('mongoose default connection disconnected')
|
||||
)
|
||||
|
||||
if (process.env.MONGOOSE_DEBUG) {
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = ProxyManager = {
|
||||
createProxy(target) {
|
||||
return function (req, res, next) {
|
||||
const targetUrl = makeTargetUrl(target, req)
|
||||
logger.log({ targetUrl, reqUrl: req.url }, 'proxying url')
|
||||
logger.debug({ targetUrl, reqUrl: req.url }, 'proxying url')
|
||||
|
||||
const options = { url: targetUrl }
|
||||
if (req.headers != null ? req.headers.cookie : undefined) {
|
||||
|
||||
@@ -277,30 +277,30 @@ webRouter.use(
|
||||
|
||||
// add CSP header to HTML-rendering routes, if enabled
|
||||
if (Settings.csp && Settings.csp.enabled) {
|
||||
logger.info('adding CSP header to rendered routes', Settings.csp)
|
||||
logger.debug('adding CSP header to rendered routes', Settings.csp)
|
||||
app.use(csp(Settings.csp))
|
||||
}
|
||||
|
||||
logger.info('creating HTTP server'.yellow)
|
||||
logger.debug('creating HTTP server'.yellow)
|
||||
const server = require('http').createServer(app)
|
||||
|
||||
// provide settings for separate web and api processes
|
||||
if (Settings.enabledServices.includes('api')) {
|
||||
logger.info('providing api router')
|
||||
logger.debug('providing api router')
|
||||
app.use(privateApiRouter)
|
||||
app.use(Validation.errorMiddleware)
|
||||
app.use(ErrorController.handleApiError)
|
||||
}
|
||||
|
||||
if (Settings.enabledServices.includes('web')) {
|
||||
logger.info('providing web router')
|
||||
logger.debug('providing web router')
|
||||
|
||||
if (Settings.precompilePugTemplatesAtBootTime) {
|
||||
logger.info('precompiling views for web in production environment')
|
||||
logger.debug('precompiling views for web in production environment')
|
||||
Views.precompileViews(app)
|
||||
}
|
||||
if (app.get('env') === 'test') {
|
||||
logger.info('enabling view cache for acceptance tests')
|
||||
logger.debug('enabling view cache for acceptance tests')
|
||||
app.enable('view cache')
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ module.exports = {
|
||||
cache: true,
|
||||
compileDebug: Settings.debugPugTemplates,
|
||||
})
|
||||
logger.log({ filename }, 'compiled')
|
||||
logger.debug({ filename }, 'compiled')
|
||||
success++
|
||||
} catch (err) {
|
||||
logger.error({ filename, err: err.message }, 'error compiling')
|
||||
failures++
|
||||
}
|
||||
})
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ timeTaken: Date.now() - startTime, failures, success },
|
||||
'compiled templates'
|
||||
)
|
||||
|
||||
@@ -104,12 +104,12 @@ module.exports = LaunchpadController = {
|
||||
sendTestEmail(req, res, next) {
|
||||
const { email } = req.body
|
||||
if (!email) {
|
||||
logger.log({}, 'no email address supplied')
|
||||
logger.debug({}, 'no email address supplied')
|
||||
return res.status(400).json({
|
||||
message: 'no email address supplied',
|
||||
})
|
||||
}
|
||||
logger.log({ email }, 'sending test email')
|
||||
logger.debug({ email }, 'sending test email')
|
||||
const emailOptions = { to: email }
|
||||
return EmailHandler.sendEmail('testEmail', emailOptions, function (err) {
|
||||
if (err != null) {
|
||||
@@ -118,7 +118,7 @@ module.exports = LaunchpadController = {
|
||||
})
|
||||
return next(err)
|
||||
}
|
||||
logger.log({ email }, 'sent test email')
|
||||
logger.debug({ email }, 'sent test email')
|
||||
res.json({ message: res.locals.translate('email_sent') })
|
||||
})
|
||||
},
|
||||
@@ -126,7 +126,7 @@ module.exports = LaunchpadController = {
|
||||
registerExternalAuthAdmin(authMethod) {
|
||||
return function (req, res, next) {
|
||||
if (LaunchpadController._getAuthMethod() !== authMethod) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ authMethod },
|
||||
'trying to register external admin, but that auth service is not enabled, disallow'
|
||||
)
|
||||
@@ -134,18 +134,18 @@ module.exports = LaunchpadController = {
|
||||
}
|
||||
const { email } = req.body
|
||||
if (!email) {
|
||||
logger.log({ authMethod }, 'no email supplied, disallow')
|
||||
logger.debug({ authMethod }, 'no email supplied, disallow')
|
||||
return res.sendStatus(400)
|
||||
}
|
||||
|
||||
logger.log({ email }, 'attempted register first admin user')
|
||||
logger.debug({ email }, 'attempted register first admin user')
|
||||
return LaunchpadController._atLeastOneAdminExists(function (err, exists) {
|
||||
if (err != null) {
|
||||
return next(err)
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ email },
|
||||
'already have at least one admin user, disallow'
|
||||
)
|
||||
@@ -158,7 +158,7 @@ module.exports = LaunchpadController = {
|
||||
first_name: email,
|
||||
last_name: '',
|
||||
}
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ body, authMethod },
|
||||
'creating admin account for specified external-auth user'
|
||||
)
|
||||
@@ -189,7 +189,7 @@ module.exports = LaunchpadController = {
|
||||
}
|
||||
|
||||
AuthenticationController.setRedirectInSession(req, '/launchpad')
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ email, user_id: user._id, authMethod },
|
||||
'created first admin account'
|
||||
)
|
||||
@@ -207,18 +207,18 @@ module.exports = LaunchpadController = {
|
||||
const { email } = req.body
|
||||
const { password } = req.body
|
||||
if (!email || !password) {
|
||||
logger.log({}, 'must supply both email and password, disallow')
|
||||
logger.debug({}, 'must supply both email and password, disallow')
|
||||
return res.sendStatus(400)
|
||||
}
|
||||
|
||||
logger.log({ email }, 'attempted register first admin user')
|
||||
logger.debug({ email }, 'attempted register first admin user')
|
||||
return LaunchpadController._atLeastOneAdminExists(function (err, exists) {
|
||||
if (err != null) {
|
||||
return next(err)
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ email: req.body.email },
|
||||
'already have at least one admin user, disallow'
|
||||
)
|
||||
@@ -233,7 +233,7 @@ module.exports = LaunchpadController = {
|
||||
return next(err)
|
||||
}
|
||||
|
||||
logger.log({ user_id: user._id }, 'making user an admin')
|
||||
logger.debug({ user_id: user._id }, 'making user an admin')
|
||||
User.updateOne(
|
||||
{ _id: user._id },
|
||||
{
|
||||
@@ -250,7 +250,7 @@ module.exports = LaunchpadController = {
|
||||
return next(err)
|
||||
}
|
||||
|
||||
logger.log(
|
||||
logger.debug(
|
||||
{ email, user_id: user._id },
|
||||
'created first admin account'
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ const AuthorizationMiddleware = require('../../../../app/src/Features/Authorizat
|
||||
|
||||
module.exports = {
|
||||
apply(webRouter) {
|
||||
logger.log({}, 'Init launchpad router')
|
||||
logger.debug({}, 'Init launchpad router')
|
||||
|
||||
webRouter.get('/launchpad', LaunchpadController.launchpadPage)
|
||||
webRouter.post(
|
||||
|
||||
@@ -5,7 +5,7 @@ const AuthorizationMiddleware = require('../../../../app/src/Features/Authorizat
|
||||
|
||||
module.exports = {
|
||||
apply(webRouter) {
|
||||
logger.log({}, 'Init UserActivate router')
|
||||
logger.debug({}, 'Init UserActivate router')
|
||||
|
||||
webRouter.get(
|
||||
'/admin/user',
|
||||
|
||||
@@ -471,7 +471,7 @@ describe('AuthenticationController', function () {
|
||||
})
|
||||
|
||||
it('should log the failed login', function () {
|
||||
this.logger.log
|
||||
this.logger.debug
|
||||
.calledWith({ email: this.email.toLowerCase() }, 'failed log in')
|
||||
.should.equal(true)
|
||||
})
|
||||
@@ -911,7 +911,7 @@ describe('AuthenticationController', function () {
|
||||
})
|
||||
|
||||
it('should log out a message', function () {
|
||||
this.logger.log
|
||||
this.logger.debug
|
||||
.calledWith(
|
||||
{ url: this.url },
|
||||
'user not logged in so redirecting to register page'
|
||||
@@ -1417,7 +1417,7 @@ describe('AuthenticationController', function () {
|
||||
})
|
||||
|
||||
it('should log the successful login', function () {
|
||||
this.logger.log
|
||||
this.logger.debug
|
||||
.calledWith(
|
||||
{ email: this.user.email, user_id: this.user._id.toString() },
|
||||
'successful log in'
|
||||
|
||||
Reference in New Issue
Block a user