mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
reduce the size of the log entry by truncating any string values to 500 characters
This commit is contained in:
parent
d5d581fc54
commit
809c572ca7
2 changed files with 5 additions and 11 deletions
|
|
@ -34,11 +34,9 @@ export class CustomTypeOrmLogger
|
|||
}
|
||||
|
||||
logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner) {
|
||||
this.logger.info(
|
||||
`query: ${query} -- PARAMETERS: ${super.stringifyParams(
|
||||
parameters || []
|
||||
)}`
|
||||
)
|
||||
this.logger.info(query, {
|
||||
parameters,
|
||||
})
|
||||
}
|
||||
|
||||
log(
|
||||
|
|
@ -133,10 +131,8 @@ const truncateObjectDeep = (object: any, length: number): any => {
|
|||
|
||||
class GcpLoggingTransport extends LoggingWinston {
|
||||
log(info: any, callback: (err: Error | null, apiResponse?: any) => void) {
|
||||
const sizeInfo = jsonStringify(info).length
|
||||
if (sizeInfo > MAX_LOG_SIZE) {
|
||||
info = truncateObjectDeep(info, 500) as never // the max length for string values is 500
|
||||
}
|
||||
// reduce the size of the log entry by truncating any string values to 500 characters
|
||||
info = truncateObjectDeep(info, 500) as never
|
||||
super.log(info, callback)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,8 +117,6 @@ export const inboundEmailHandler = Sentry.GCPFunction.wrapHttpFunction(
|
|||
}
|
||||
}
|
||||
const headers = parseHeaders(parsed.headers)
|
||||
console.log('parsed: ', parsed)
|
||||
console.log('headers: ', headers)
|
||||
|
||||
// original sender email address
|
||||
const from = parsed['from']
|
||||
|
|
|
|||
Loading…
Reference in a new issue