mirror of
https://github.com/vernu/textbee.git
synced 2026-04-17 13:28:36 -04:00
chore(api): logging improvements
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user