docs: structlog replacing loguru#9791
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughDocumentation updates adjust default storage paths and terminology: components now reference the Langflow data directory; flows are described as stored in a SQLite database with updated per-OS paths and env vars; logging docs switch to structlog with JSON output, new config directory handling, and revised environment configuration. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User/App
participant L as Langflow Core
participant DB as SQLite Database
participant LG as structlog
participant FS as Log Files (JSON in config dir)
U->>L: Run flow / save component output
L->>DB: Read/Write flow execution data
Note over DB: Path configurable via<br/>LANGFLOW_DATABASE_URL
L->>LG: Emit structured log events
LG->>FS: Write JSON logs (rotated)
Note over FS: Location under LANGFLOW_CONFIG_DIR
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/docs/Develop/logging.mdx (1)
122-156: Make Windows Desktop paths consistent with earlier section and normalize casing.Earlier we list Roaming\cache; here we instruct LocalAppData\logs with different casing. Unify on
%LOCALAPPDATA%\com.Langflow\logs(if that’s the Desktop default) and use the same in both places.- cd %LOCALAPPDATA%\com.langflow\logs + cd %LOCALAPPDATA%\com.Langflow\logsIf Desktop truly writes to Roaming\com.Langflow\cache, update both places to match and adjust the folder name (“logs” vs “cache”) accordingly.
🧹 Nitpick comments (5)
docs/docs/Components/components-processing.mdx (2)
649-656: Clarify default “data directory” and align examples with OS variants.“Langflow data directory” isn’t defined on this page, and the lone macOS example may confuse Windows/Linux users. Link to the canonical location and avoid hardcoded OS paths here.
Apply:
- * **Default location**: If you only provide a file name, then the file is stored in the Langflow data directory (e.g., `~/Library/Caches/langflow/data` on macOS). + * **Default location**: If you only provide a file name, the file is stored in Langflow storage. See [Memory management options](/memory) for the per‑OS path.- * **Subdirectory**: To store files in subdirectories, add the path to the **File Name** parameter. - For example, `subdirectory/my_file` creates `my_file` in the data directory's subdirectory. + * **Subdirectory**: To store files in subdirectories under the default storage, add the relative path to **File Name**. + For example, `subdirectory/my_file` creates `my_file` in a subdirectory of the default storage.- * **Absolute or relative path**: To store files elsewhere in your system or the local file system, provide the absolute or relative path to the desired location. + * **Absolute or relative path**: To store files elsewhere, provide an absolute or relative filesystem path.
683-684: Make the success-path example OS‑agnostic.Hardcoding a macOS path can mislead. Show a generic placeholder and point to where users find the actual path.
- DataFrame saved successfully as 'my_file.csv' at /Users/user.name/Library/Caches/langflow/data/my_file.csv + DataFrame saved successfully as 'my_file.csv' at <your-default-langflow-storage>/my_file.csvdocs/docs/Develop/logging.mdx (2)
78-79: Fix grammar.“For the each” → “for each”.
-After you run a flow, you can inspect the logs for the each component and flow run. +After you run a flow, you can inspect the logs for each component and flow run.
108-110: Cross‑reference duplication.This repeats storage location guidance; consider linking back to “Log storage” once to avoid divergence.
-You can find `.log` files for flows at your Langflow installation's log storage location. -For filepaths, see [Log storage](#log-storage). +Flow `.log` files live under your log storage. See [Log storage](#log-storage).docs/docs/Concepts/concepts-flows.mdx (1)
115-118: Capitalize “Flow” per docs style and tighten the wording.-**Application logs** (startup, errors, etc.) are stored separately in the config directory. For log file locations, see [Logging documentation](/logging). +**Application logs** (startup, errors, etc.) are stored separately in the config directory. For file locations, see [Logs](/logging).-The database storage location can be customized with the `LANGFLOW_DATABASE_URL` environment variable, and the config directory can be customized with the `LANGFLOW_CONFIG_DIR` environment variable. +The database location is configurable via `LANGFLOW_DATABASE_URL`. The config directory is configurable via `LANGFLOW_CONFIG_DIR`.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docs/docs/Components/components-processing.mdx(2 hunks)docs/docs/Concepts/concepts-flows.mdx(1 hunks)docs/docs/Develop/logging.mdx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (.cursor/rules/docs_development.mdc)
docs/docs/**/*.{md,mdx}: All documentation content must be written in Markdown or MDX files located under docs/docs/, following the prescribed directory structure for guides, reference, how-to, concepts, and API documentation.
All documentation Markdown and MDX files must begin with a frontmatter block including at least title and description fields.
Use admonitions (:::tip, :::warning, :::danger) in Markdown/MDX files to highlight important information, warnings, or critical issues.
All images referenced in documentation must include descriptive alt text for accessibility.
All code examples included in documentation must be tested and verified to work as shown.
Internal links in documentation must be functional and not broken.
Content must follow the style guide: professional but approachable tone, second person voice, present tense, short paragraphs, sentence case headers, inline code with backticks, bold for UI elements, italic for emphasis, and parallel structure in lists.
Use consistent terminology: always capitalize Langflow, Component, Flow, and uppercase API and JSON.
Files:
docs/docs/Concepts/concepts-flows.mdxdocs/docs/Develop/logging.mdxdocs/docs/Components/components-processing.mdx
🧠 Learnings (5)
📓 Common learnings
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase has an excellent structlog implementation that follows best practices, with proper global configuration, environment-based output formatting, and widespread adoption across components. The main cleanup needed is updating starter project templates and documentation examples that still contain legacy `from loguru import logger` imports.
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: Some Langflow starter project files and components still use `from loguru import logger` instead of the centralized structlog logger from `langflow.logging.logger`. These should be updated to ensure consistent structured logging across the entire codebase.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-07-18T18:26:42.027Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize Langflow, Component, Flow, and uppercase API and JSON.
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase uses structlog for structured logging with a centralized configuration in `src/backend/base/langflow/logging/logger.py`. The configuration supports multiple output formats (JSON, CSV, console) based on environment settings and properly implements global log level filtering.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Applies to src/backend/base/langflow/components/**/*.py : Add new backend components to the appropriate subdirectory under src/backend/base/langflow/components/
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase uses structlog for structured logging with a centralized configuration in `src/backend/base/langflow/logging/logger.py`. The configuration supports multiple output formats (JSON, CSV, console) based on environment settings and properly implements global log level filtering.
Applied to files:
docs/docs/Concepts/concepts-flows.mdxdocs/docs/Develop/logging.mdx
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase has an excellent structlog implementation that follows best practices, with proper global configuration, environment-based output formatting, and widespread adoption across components. The main cleanup needed is updating starter project templates and documentation examples that still contain legacy `from loguru import logger` imports.
Applied to files:
docs/docs/Develop/logging.mdx
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: Some Langflow starter project files and components still use `from loguru import logger` instead of the centralized structlog logger from `langflow.logging.logger`. These should be updated to ensure consistent structured logging across the entire codebase.
Applied to files:
docs/docs/Develop/logging.mdx
📚 Learning: 2025-07-18T18:26:42.027Z
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-07-18T18:26:42.027Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize Langflow, Component, Flow, and uppercase API and JSON.
Applied to files:
docs/docs/Components/components-processing.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test Docs Build / Test Docs Build
- GitHub Check: build-and-deploy
🔇 Additional comments (3)
docs/docs/Develop/logging.mdx (3)
12-18: Good switch to structlog and JSON note.The introduction correctly reflects the current logging backend and structured output. No issues here.
57-65: ConfirmLANGFLOW_LOG_FILEandcontainer_jsonalias exist.Docs advertise both, but they may have been removed in recent logger refactors.
If either is absent, remove or adjust the docs accordingly. See the verification script above.
74-74: Nice pointer to .env example.Helpful cross-reference.
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
aimurphy
left a comment
There was a problem hiding this comment.
One Windows/*nix path seems to be missing, and there is mismatch in the real-time logs tabs.
This comment has been minimized.
This comment has been minimized.
…ow-ai/langflow into docs-migrate-to-structlog
This comment has been minimized.
This comment has been minimized.
aimurphy
left a comment
There was a problem hiding this comment.
approved with just a couple small things
|
|
||
| The following environment variables are available to configure logging: | ||
|
|
||
| * `LANGFLOW_CONFIG_DIR`: Sets the config directory where logs and cache files are stored. For example, `LANGFLOW_CONFIG_DIR=/path/to/config`. |
There was a problem hiding this comment.
When you are merging your environment variables PR and this PR, double check that these changes aren't lost to the other PR. You might have to manually replicate them in that PR.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
|
Build successful! ✅ |
* initial-content * config-dir-and-data-are-separate * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * code-review * add-partial-for-locations * use-windows-oss-path * reorder * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>



This pull request updates the documentation to clarify Langflow's storage and logging behavior. T
Logging page preview
Summary by CodeRabbit