Skip to content

[DeepNext] Resolve issue #165: Make logging by default on INFO level#169

Closed
pjedlikowskistx wants to merge 1 commit intodevelopfrom
deep_next/issue_165/2025_09_25_09_30_50
Closed

[DeepNext] Resolve issue #165: Make logging by default on INFO level#169
pjedlikowskistx wants to merge 1 commit intodevelopfrom
deep_next/issue_165/2025_09_25_09_30_50

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

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🚀 DeepNext is onto it! Hold on...

@pjedlikowskistx
Copy link
Contributor Author

🚧 DeepNext status update

🔴 DeepNext app failed for MR #169: 1 validation error for _State
code_context
Input should be a valid dictionary or instance of ExistingCodeContext [type=model_type, input_value=[], input_type=list]
For further information visit https://errors.pydantic.dev/2.11/v/model_type

@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)

### Understanding the Task & Approach
The goal is to make INFO the default logging level for the project, and allow users to
override it via a LOG_LEVEL environment variable. This reduces log verbosity by default,
but provides flexibility for debugging or production needs. The project uses Loguru for
logging, and logging is initialized in multiple entrypoints (core pipeline, app, and
scheduled runner). The LOG_LEVEL should be read from the environment (with a default of
INFO), and Loguru should be configured accordingly at the very start of each entrypoint.
The .env.example should be updated to document LOG_LEVEL for user awareness.
Centralizing the logic for reading LOG_LEVEL and configuring Loguru in a shared utility
(e.g., in libs/common/deep_next/common/common.py) ensures consistency and avoids code
duplication. This approach is simple, maintainable, and aligns with project conventions.

### Trade-offs & Dependencies
- Centralizing logger setup avoids code duplication and ensures all entrypoints behave
the same.
- Updating .env.example is independent and can be done at any time.
- All entrypoints must call the logger setup before any logging occurs.
- No need to refactor existing log statements, only the logger initialization.

### Step Order
1. Centralize logger setup in a shared utility.
2. Update all entrypoints to use the new logger setup, ensuring LOG_LEVEL is respected.
3. Document LOG_LEVEL in .env.example for user discoverability.

Action Plan

What do you think about the action plan below?

[
    {
        "title": "Add a centralized logger setup function that reads LOG_LEVEL from the environment and configures Loguru",
        "description": "In libs/common/deep_next/common/common.py, implement a function (e.g., setup_logger_from_env) that:\n- Reads the LOG_LEVEL environment variable (defaulting to INFO if not set).\n- Configures Loguru to use this level for all logging.\n- Optionally, removes any default Loguru handlers to avoid duplicate logs.\nThis function should be reusable from all entrypoints.",
        "target_file": "Path(/deep-next/___data/app/repositories/stxnext_deep-next/libs/common/deep_next/common/common.py)"
    },
    {
        "title": "Update all entrypoints to use the centralized logger setup",
        "description": "In each entrypoint (apps/app/deep_next/app/entrypoint.py, apps/app/deep_next/app/entrypoint_scheduled.py, libs/core/deep_next/core/entrypoint.py):\n- Import and call the new setup_logger_from_env function at the very start of the script (before any logging occurs).\n- Remove any previous ad-hoc logger configuration related to log level.\nThis ensures all logs respect the LOG_LEVEL environment variable and default to INFO.",
        "target_file": "Path(/deep-next/___data/app/repositories/stxnext_deep-next/apps/app/deep_next/app/entrypoint.py)"
    },
    {
        "title": "Update .env.example to document the LOG_LEVEL variable",
        "description": "Add a commented line to .env.example explaining the LOG_LEVEL variable, its default (INFO), and possible values (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL). This helps users discover and configure logging as needed.",
        "target_file": "Path(/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: 480 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