mirror of
https://github.com/docmost/docmost.git
synced 2025-11-19 06:21:10 +10:00
cleanups
This commit is contained in:
@ -2,17 +2,22 @@ import { MailDriver } from './interfaces/mail-driver.interface';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { MailMessage } from '../interfaces/mail.message';
|
||||
import { mailLogName } from '../mail.utils';
|
||||
import * as process from 'node:process';
|
||||
|
||||
export class LogDriver implements MailDriver {
|
||||
private readonly logger = new Logger(mailLogName(LogDriver.name));
|
||||
|
||||
async sendMail(message: MailMessage): Promise<void> {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
return;
|
||||
}
|
||||
|
||||
const mailLog = {
|
||||
to: message.to,
|
||||
subject: message.subject,
|
||||
text: message.text,
|
||||
};
|
||||
|
||||
this.logger.log(`Logged mail: ${JSON.stringify(mailLog)}`);
|
||||
this.logger.log(`Logged email: ${JSON.stringify(mailLog)}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user