correct log output

This commit is contained in:
clauspeterhuebner 2026-02-19 01:53:47 +01:00
parent 365bc9b7ac
commit d13f87b964

View File

@ -98,17 +98,17 @@ export class SendEmailCommand extends BaseCommand<Record<string, unknown> | bool
private getEmailResult(result: Record<string, unknown> | boolean | null | Error): string {
const methodLogger = createLogger(`getEmailResult`)
if (methodLogger.isDebugEnabled()) {
methodLogger.debug(`getEmailResult() result=${JSON.stringify(result)}`)
methodLogger.debug(`result=${JSON.stringify(result)}`)
}
let emailResult: string;
if(result === null) {
emailResult = `getEmailResult() result is null`
emailResult = `result is null`
}
else if(typeof result === 'boolean') {
emailResult = `getEmailResult() result is ${result}`
emailResult = `result is ${result}`
}
else if(result instanceof Error) {
emailResult = `getEmailResult() error-message is ${result.message}`
emailResult = `error-message is ${result.message}`
}
else if(typeof result === 'object') {
// {"accepted":["stage5@gradido.net"],"rejected":[],"ehlo":["PIPELINING","SIZE 25600000","ETRN","AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN","ENHANCEDSTATUSCODES","8BITMIME","DSN","CHUNKING"],"envelopeTime":23,"messageTime":135,"messageSize":37478,"response":"250 2.0.0 Ok: queued as C45C2100BD7","envelope":{"from":"stage5@gradido.net","to":["stage5@gradido.net"]},"messageId":"<d269161f-f3d2-2c96-49c0-58154366271b@gradido.net>"
@ -116,10 +116,10 @@ export class SendEmailCommand extends BaseCommand<Record<string, unknown> | bool
const messageSize = (result as Record<string, unknown>).messageSize;
const response = (result as Record<string, unknown>).response;
const envelope = JSON.stringify((result as Record<string, unknown>).envelope);
emailResult = `getEmailResult() accepted=${accepted}, messageSize=${messageSize}, response=${response}, envelope=${envelope}`
emailResult = `accepted=${accepted}, messageSize=${messageSize}, response=${response}, envelope=${envelope}`
}
else {
emailResult = `getEmailResult() result is unknown type`
emailResult = `result is unknown type`
}
return emailResult;