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: 125 seconds.

@pjedlikowskistx
Copy link
Contributor Author

@deepnext
Add some documentation to the README file.

@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—per the latest feedback—add documentation to the
README file. The project uses Loguru for logging, and logging is initialized in multiple
entrypoints. To ensure maintainability and consistency, a centralized setup_logging()
function should be implemented in libs/common/deep_next/common/common.py. All
entrypoints (apps/app/deep_next/app/entrypoint.py,
apps/app/deep_next/app/entrypoint_scheduled.py, libs/core/deep_next/core/entrypoint.py)
should call this function after loading environment variables and before any logger
usage. The .env.example file should include a commented LOG_LEVEL example for user
guidance. Finally, the README.md should be updated to document the LOG_LEVEL environment
variable and explain how to configure logging, as requested in the feedback. This
approach ensures discoverability, consistency, and ease of configuration for users.

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 and logging configuration in README.md",
        "description": "Update the README.md file to document the LOG_LEVEL environment variable and explain how to configure the logging level. Include a brief section under Configuration or a dedicated Logging section, describing the default INFO level, how to override it, and where to set LOG_LEVEL.",
        "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: 31 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: 45 seconds.


🎉 Issue solved! See you next time!

Comment on lines 67 to 72
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 configured. LOG_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.

Add more docstring description.

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 192 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