chore(api): logging improvements

This commit is contained in:
isra el
2026-03-23 13:54:52 +03:00
parent 002ac9c144
commit 7bec9e8acf
6 changed files with 11 additions and 12 deletions

View File

@@ -24,7 +24,6 @@ import { EventEmitterModule } from '@nestjs/event-emitter'
@Injectable()
export class LoggerMiddleware implements NestMiddleware {
use(req: Request, res: Response, next: NextFunction) {
console.log('req.originalUrl: ', req.originalUrl)
if (next) {
next()
}
@@ -41,7 +40,7 @@ export class LoggerMiddleware implements NestMiddleware {
ThrottlerModule.forRoot([
{
ttl: 60000,
limit: 60,
limit: 500,
},
]),
ScheduleModule.forRoot(),

View File

@@ -530,7 +530,7 @@ export class BillingService {
}
if (user.emailVerifiedAt === null) {
console.error('canPerformAction: User email not verified')
console.warn('canPerformAction: User email not verified')
throw new HttpException(
{
message: 'Please verify your email to continue',
@@ -618,8 +618,8 @@ export class BillingService {
}
if (hasReachedLimit) {
console.error('canPerformAction: hasReachedLimit')
console.error(
console.warn('canPerformAction: hasReachedLimit')
console.warn(
JSON.stringify({
userId,
userEmail: user.email,

View File

@@ -55,7 +55,7 @@ export class SmsQueueProcessor {
concurrency: 10,
})
async handleSendSms(job: Job<any>) {
this.logger.debug(`Processing send-sms job ${job.id}`)
// this.logger.debug(`Processing send-sms job ${job.id}`)
const { deviceId, fcmMessages, smsBatchId } = job.data
const device = await this.deviceModel
@@ -84,9 +84,9 @@ export class SmsQueueProcessor {
const response = await firebaseAdmin.messaging().sendEach(fcmMessages)
this.logger.debug(
`SMS Job ${job.id} completed, success: ${response.successCount}, failures: ${response.failureCount}`,
)
// this.logger.debug(
// `SMS Job ${job.id}( smsBatchId: ${smsBatchId}) completed, success: ${response.successCount}, failures: ${response.failureCount}`,
// )
// Mark individual SMS records as failed when their FCM push failed
for (let i = 0; i < response.responses.length; i++) {

View File

@@ -34,7 +34,7 @@ export class SmsQueueService {
smsBatchId: string,
delayMs?: number,
) {
this.logger.debug(`Adding send-sms job for batch ${smsBatchId}`)
// this.logger.debug(`Adding send-sms job for batch ${smsBatchId}`)
// Split messages into batches of max smsBatchSize messages
const batches = []

View File

@@ -14,7 +14,7 @@ export class WebhookQueueProcessor {
concurrency: 10,
})
async handleWebhookDelivery(job: Job<{ notificationId: string }>) {
this.logger.debug(`Processing webhook delivery job ${job.id} for notification ${job.data.notificationId}`)
// this.logger.debug(`Processing webhook delivery job ${job.id} for notification ${job.data.notificationId}`)
try {
await this.webhookService.attemptWebhookDelivery(job.data.notificationId)

View File

@@ -12,7 +12,7 @@ export class WebhookQueueService {
) {}
async addWebhookDeliveryJob(notificationId: string) {
this.logger.debug(`Adding webhook delivery job for notification ${notificationId}`)
// this.logger.debug(`Adding webhook delivery job for notification ${notificationId}`)
await this.webhookQueue.add(
'deliver-webhook',