Skip to content

Conversation

@pjedlikowskistx
Copy link
Contributor

This is description for the MR created by DeepNext.

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

Reasoning (for context only)

The goal is to make INFO the default logging level and allow overriding it via the
LOG_LEVEL environment variable. The project uses Loguru for logging, and logging is
initialized in multiple entrypoints (apps/app/deep_next/app/entrypoint.py,
apps/app/deep_next/app/entrypoint_scheduled.py, libs/core/deep_next/core/entrypoint.py).
To ensure consistent behavior and avoid code duplication, a centralized logging setup
function should be implemented in a shared utility module
(libs/common/deep_next/common/common.py). This function will read the LOG_LEVEL
environment variable (defaulting to INFO), remove existing Loguru handlers, and add a
new handler with the correct level. All entrypoints should call this setup function
immediately after loading environment variables and before any logger usage. Adding a
LOG_LEVEL example to .env.example will help users discover and configure this option.
This approach is simple, maintainable, and aligns with project conventions.

Action Plan

What do you think about the action plan below?

[
    {
        "title": "Implement setup_logging() in common.py",
        "description": "Add a `setup_logging()` function to `libs/common/deep_next/common/common.py`. This function should:\n- Read the `LOG_LEVEL` environment variable (default to 'INFO' if not set).\n- Remove all existing Loguru handlers.\n- Add a new Loguru handler for stdout with the specified log level.\n- Optionally, print a debug message indicating the active log level.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/libs/common/deep_next/common/common.py)"
    },
    {
        "title": "Call setup_logging() in main entrypoint",
        "description": "In `apps/app/deep_next/app/entrypoint.py`:\n- After loading environment variables (`load_monorepo_dotenv`), call `setup_logging()` before any logger usage.\n- This ensures the log level is set before any log messages are emitted.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/apps/app/deep_next/app/entrypoint.py)"
    },
    {
        "title": "Call setup_logging() in scheduled entrypoint",
        "description": "In `apps/app/deep_next/app/entrypoint_scheduled.py`:\n- After loading environment variables, call `setup_logging()` before any logger usage.\n- This ensures consistent logging configuration in the scheduled tasks.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/apps/app/deep_next/app/entrypoint_scheduled.py)"
    },
    {
        "title": "Call setup_logging() in core entrypoint",
        "description": "In `libs/core/deep_next/core/entrypoint.py`:\n- After loading environment variables, call `setup_logging()` before any logger usage.\n- This ensures consistent logging in the core CLI functionality.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/libs/core/deep_next/core/entrypoint.py)"
    },
    {
        "title": "Add LOG_LEVEL example to .env.example",
        "description": "Add a commented example of the `LOG_LEVEL` variable to `.env.example`, e.g.:\n# LOG_LEVEL=INFO\nThis helps users discover and configure the log level as needed.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/.env.example)"
    }
]

How to respond?

👌 To ACCEPT the action plan, respond with:

@deepnext
OK

✏️ To REQUEST CHANGES to the action plan, talk to DeepNext following the message format:

@deepnext
<message to DeepNext>

🟢 Step finished. Waiting for your response...

⏱️ DeepNext core execution time: 100 seconds.

@pjedlikowskistx
Copy link
Contributor Author

@deepnext
Add some documentation to README

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

Reasoning (for context only)

The task is to make INFO the default logging level, allow overriding it via the
LOG_LEVEL environment variable, and—based on feedback—add documentation to the README.
The project uses Loguru for logging, and logging is initialized in multiple entrypoints.
To ensure consistent behavior and avoid code duplication, a centralized setup_logging()
function should be implemented in libs/common/deep_next/common/common.py. All
entrypoints should call this function after loading environment variables and before any
logger usage. The .env.example should include a commented LOG_LEVEL example for
discoverability. Finally, the README should be updated to document the LOG_LEVEL
variable and its effect, as requested in the feedback. This approach is simple,
maintainable, and aligns with project conventions.

Action Plan

What do you think about the action plan below?

[
    {
        "title": "Implement setup_logging() in common.py",
        "description": "Add a `setup_logging()` function to `libs/common/deep_next/common/common.py`. This function should:\n- Read the `LOG_LEVEL` environment variable (default to 'INFO' if not set).\n- Remove all existing Loguru handlers.\n- Add a new Loguru handler for stdout with the specified log level.\n- Optionally, print a debug message indicating the active log level.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/libs/common/deep_next/common/common.py)"
    },
    {
        "title": "Call setup_logging() in main entrypoint",
        "description": "In `apps/app/deep_next/app/entrypoint.py`:\n- After loading environment variables (`load_monorepo_dotenv`), call `setup_logging()` before any logger usage.\n- This ensures the log level is set before any log messages are emitted.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/apps/app/deep_next/app/entrypoint.py)"
    },
    {
        "title": "Call setup_logging() in scheduled entrypoint",
        "description": "In `apps/app/deep_next/app/entrypoint_scheduled.py`:\n- After loading environment variables, call `setup_logging()` before any logger usage.\n- This ensures consistent logging configuration in the scheduled tasks.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/apps/app/deep_next/app/entrypoint_scheduled.py)"
    },
    {
        "title": "Call setup_logging() in core entrypoint",
        "description": "In `libs/core/deep_next/core/entrypoint.py`:\n- After loading environment variables, call `setup_logging()` before any logger usage.\n- This ensures consistent logging in the core CLI functionality.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/libs/core/deep_next/core/entrypoint.py)"
    },
    {
        "title": "Add LOG_LEVEL example to .env.example",
        "description": "Add a commented example of the `LOG_LEVEL` variable to `.env.example`, e.g.:\n# LOG_LEVEL=INFO\nThis helps users discover and configure the log level as needed.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/.env.example)"
    },
    {
        "title": "Document LOG_LEVEL in README",
        "description": "Update the `README.md` to document the `LOG_LEVEL` environment variable. Explain its purpose (controls the default log verbosity), the default value (INFO), and how users can override it for more or less verbose output. Place this in the Configuration section or where other environment variables are described.",
        "target_file": "Path(/home/patryk/PROJECTS/deep-next/___data/app/repositories/stxnext_deep-next/README.md)"
    }
]

How to respond?

👌 To ACCEPT the action plan, respond with:

@deepnext
OK

✏️ To REQUEST CHANGES to the action plan, talk to DeepNext following the message format:

@deepnext
<message to DeepNext>

🟢 Step finished. Waiting for your response...

⏱️ DeepNext core execution time: 33 seconds.

@pjedlikowskistx
Copy link
Contributor Author

@deepnext
OK

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

💾 Action plan successfully implemented.


🟢 Step finished.

⏱️ DeepNext core execution time: 21 seconds.


🎉 Issue solved! See you next time!

Comment on lines 23 to 28
def setup_logging() -> None:
"""Configures Loguru logging level from LOG_LEVEL env variable (default INFO)."""
log_level = os.environ.get("LOG_LEVEL", "INFO").upper()
logger.remove()
logger.add(sys.stdout, level=log_level)
logger.debug(f"Loguru logging set to level: {log_level}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change default log level to warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✅ DeepNext is applying Your suggestion(s)

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

Found code review suggestions... applying

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

('Code review completed. All suggestions applied within 70 seconds.',)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant