mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 12:51:35 +02:00
Revert "Improve GCP logging for web" GitOrigin-RevId: 92d446baf62108da1df92146eec12a2fe69d30ee
33 lines
845 B
JavaScript
33 lines
845 B
JavaScript
const { SamlLog } = require('../../models/SamlLog')
|
|
const logger = require('logger-sharelatex')
|
|
|
|
function log(providerId, sessionId, data) {
|
|
try {
|
|
const samlLog = new SamlLog()
|
|
samlLog.providerId = providerId = (providerId || '').toString()
|
|
samlLog.sessionId = sessionId = (sessionId || '').toString().substr(0, 8)
|
|
try {
|
|
samlLog.jsonData = JSON.stringify(data)
|
|
} catch (err) {
|
|
// log but continue on data errors
|
|
logger.error(
|
|
{ err, sessionId, providerId },
|
|
'SamlLog JSON.stringify Error'
|
|
)
|
|
}
|
|
samlLog.save(err => {
|
|
if (err) {
|
|
logger.error({ err, sessionId, providerId }, 'SamlLog Error')
|
|
}
|
|
})
|
|
} catch (err) {
|
|
logger.error({ err, sessionId, providerId }, 'SamlLog Error')
|
|
}
|
|
}
|
|
|
|
const SamlLogHandler = {
|
|
log,
|
|
}
|
|
|
|
module.exports = SamlLogHandler
|