Skip to content

Commit

Permalink
CB-5 Remove Sentry log sink in development environment
Browse files Browse the repository at this point in the history
  • Loading branch information
izzat5233 committed Nov 9, 2024
1 parent 75c7e38 commit 4ca1201
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ LLM generation calls, and other processing tasks.

## Setup

- Add `.env` file in the `app` directory with the following content:

```env
LOG_LEVEL= (optional)
SENTRY_DSN=
SENTRY_LOG_LEVEL= (optional)
SENTRY_ENVIRONMENT= (optional)
```
- Add `.env` file in the `app` directory (no variables are required for now).

## Commands

Expand Down
10 changes: 5 additions & 5 deletions app/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
serialize=True,
)


# Sentry sink
def sentry_sink(message):
if message.record["level"].name in (SENTRY_LOG_LEVEL, "CRITICAL"):
sentry_sdk.capture_message(message)
if SENTRY_ENVIRONMENT != "development":
def sentry_sink(message):
if message.record["level"].name in (SENTRY_LOG_LEVEL, "CRITICAL"):
sentry_sdk.capture_message(message)


logger.add(sentry_sink, level=SENTRY_LOG_LEVEL)
logger.add(sentry_sink, level=SENTRY_LOG_LEVEL)

__all__ = ["logger"]

0 comments on commit 4ca1201

Please sign in to comment.