Skip to content

Commit

Permalink
refactor: Support different log levels for different environments (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
egekocabas authored Jan 10, 2024
1 parent 2e9bdb2 commit 7dae571
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion parma_mining/discord/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
ServersRequest,
)

logging.basicConfig(level=logging.INFO)
env = os.getenv("env", "local")

if env == "prod":
logging.basicConfig(level=logging.INFO)
elif env in ["staging", "local"]:
logging.basicConfig(level=logging.DEBUG)
else:
logging.warning(f"Unknown environment '{env}'. Defaulting to INFO level.")
logging.basicConfig(level=logging.INFO)

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 7dae571

Please sign in to comment.