mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #14296 from overleaf/jpa-error-serializer
[logger] serialize "error" field with customer error serializer GitOrigin-RevId: 1cb588e84798c96286aec8f7f054570270a36b72
This commit is contained in:
@@ -13,6 +13,7 @@ const ENTRY_FIELDS_TO_OMIT = [
|
|||||||
'pid',
|
'pid',
|
||||||
'msg',
|
'msg',
|
||||||
'err',
|
'err',
|
||||||
|
'error',
|
||||||
'req',
|
'req',
|
||||||
'res',
|
'res',
|
||||||
]
|
]
|
||||||
@@ -25,20 +26,22 @@ function convertLogEntry(entry) {
|
|||||||
|
|
||||||
// Error information. In GCP, the stack trace goes in the message property.
|
// Error information. In GCP, the stack trace goes in the message property.
|
||||||
// This enables the error reporting feature.
|
// This enables the error reporting feature.
|
||||||
if (entry.err) {
|
const err = entry.err || entry.error
|
||||||
if (entry.err.info) {
|
if (err) {
|
||||||
Object.assign(gcpEntry, entry.err.info)
|
if (err.info) {
|
||||||
|
Object.assign(gcpEntry, err.info)
|
||||||
}
|
}
|
||||||
if (entry.err.code) {
|
if (err.code) {
|
||||||
gcpEntry.code = entry.err.code
|
gcpEntry.code = err.code
|
||||||
}
|
}
|
||||||
if (entry.err.signal) {
|
if (err.signal) {
|
||||||
gcpEntry.signal = entry.err.signal
|
gcpEntry.signal = err.signal
|
||||||
}
|
}
|
||||||
if (entry.err.stack !== '(no stack)') {
|
const stack = err.stack
|
||||||
gcpEntry.message = entry.err.stack
|
if (stack && stack !== '(no stack)') {
|
||||||
} else if (entry.err.message) {
|
gcpEntry.message = stack
|
||||||
gcpEntry.message = entry.err.message
|
} else if (err.message) {
|
||||||
|
gcpEntry.message = err.message
|
||||||
}
|
}
|
||||||
if (entry.name) {
|
if (entry.name) {
|
||||||
gcpEntry.serviceContext = { service: entry.name }
|
gcpEntry.serviceContext = { service: entry.name }
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const LoggingManager = {
|
|||||||
name,
|
name,
|
||||||
serializers: {
|
serializers: {
|
||||||
err: Serializers.err,
|
err: Serializers.err,
|
||||||
|
error: Serializers.err,
|
||||||
req: Serializers.req,
|
req: Serializers.req,
|
||||||
res: Serializers.res,
|
res: Serializers.res,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user