Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.dev
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
ENVIRONMENT=development
ENVIRONMENT=development

LOGFIRE_TOKEN=""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider adding documentation for token acquisition.

The LOGFIRE_TOKEN addition is correct, but consider adding a comment explaining how developers can obtain a Logfire token for local development.

+# Get your Logfire token from https://logfire.pydantic.dev/
LOGFIRE_TOKEN=""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOGFIRE_TOKEN=""
# Get your Logfire token from https://logfire.pydantic.dev/
LOGFIRE_TOKEN=""
🤖 Prompt for AI Agents
In the .env.dev file at line 3, add a comment above or next to the LOGFIRE_TOKEN
variable explaining how developers can obtain a Logfire token for local
development. This comment should briefly describe the process or provide a
reference link to the documentation or website where the token can be generated
or requested.

1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ assignees: ''


**Description:**
- A clear and concise description of what the pull request is about.
581 changes: 572 additions & 9 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pydantic = "^2.10.5"
pydantic-settings = "^2.7.1"
loguru = "^0.7.3"
httpx = "^0.28.1"
logfire = "^3.22.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.4"
Expand Down
5 changes: 4 additions & 1 deletion src/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ class Settings(BaseSettings):
ENVIRONMENT: Environment = Environment.PRODUCTION

#: Project name
PROJECT_NAME: str = ""
PROJECT_NAME: str = "your_project_name"

#: Project version
PROJECT_VERSION: str = "0.1.0"

#: Logging
LOGFIRE_TOKEN: str = ""


settings = Settings(_env_file=".env", _env_file_encoding="utf-8") # type: ignore[call-arg]
4 changes: 3 additions & 1 deletion src/core/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

class Environment(Enum):
DEVELOPMENT = "development"
PRODUCTION = "production"
STAGING = "staging"
CI = "ci"
TEST = "test"
PRODUCTION = "production"
15 changes: 12 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import logfire
from loguru import logger

from src.core.config import settings


# Configure loguru logger
logger.add("logs/debug.log", rotation="1 MB", retention="10 days", level="DEBUG")
# configure logfire
logfire.configure(
send_to_logfire="if-token-present",
token=settings.LOGFIRE_TOKEN,
service_name=settings.PROJECT_NAME,
environment=settings.ENVIRONMENT.value,
)

# configure loguru to send logs to logfire
logger.configure(handlers=[logfire.loguru_handler()])


def main() -> None:
Expand All @@ -14,7 +23,7 @@ def main() -> None:
Returns:
None
"""
print(settings.PROJECT_NAME)
logger.info("Hello, world!")


if __name__ == "__main__":
Expand Down
Loading