feat: logs only for backend

This commit is contained in:
Nevo David 2025-07-30 21:32:12 +07:00
parent 70ff3a5b30
commit cb09a505d8
6 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
initializeSentry('backend');
initializeSentry('backend', true);
import { loadSwagger } from '@gitroom/helpers/swagger/load.swagger';

View File

@ -1,5 +1,5 @@
// import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
// initializeSentry('cron');
import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
initializeSentry('cron');
import { NestFactory } from '@nestjs/core';
import { CronModule } from './cron.module';

View File

@ -11,7 +11,6 @@
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
"lib": ["es2020", "dom"],
"plugins": [
{
"name": "next"

View File

@ -1,5 +1,5 @@
// import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
// initializeSentry('workers');
import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
initializeSentry('workers');
import { NestFactory } from '@nestjs/core';

View File

@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import OpenAI from 'openai';
import OpenAI from 'openai q';
import { shuffle } from 'lodash';
import { zodResponseFormat } from 'openai/helpers/zod';
import { z } from 'zod';

View File

@ -2,7 +2,7 @@ import * as Sentry from '@sentry/nestjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
import { capitalize } from 'lodash';
export const initializeSentry = (appName: string) => {
export const initializeSentry = (appName: string, allowLogs = false) => {
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) {
return null;
}
@ -24,7 +24,7 @@ export const initializeSentry = (appName: string) => {
integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
Sentry.consoleLoggingIntegration({ levels: ['log', 'error', 'warn'] }),
...allowLogs ? [Sentry.consoleLoggingIntegration({ levels: ['log', 'error', 'warn'] })] : [],
],
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
enableLogs: true,