Skip to content

docs: structlog replacing loguru#9791

Merged
mendonk merged 13 commits into
mainfrom
docs-migrate-to-structlog
Sep 12, 2025
Merged

docs: structlog replacing loguru#9791
mendonk merged 13 commits into
mainfrom
docs-migrate-to-structlog

Conversation

@mendonk
Copy link
Copy Markdown
Collaborator

@mendonk mendonk commented Sep 9, 2025

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

  • Structlog replacing loguru
  • Add example for tailing logs
  • Database db is separate from logs storage (by default - config_dir vs /data)
  • Database backed storage for flows.

Summary by CodeRabbit

  • Documentation
    • Updated Save File docs: clarified default storage in the Langflow data directory, revised path examples, and refined absolute/relative path guidance and success message sample.
    • Revised Flows docs: storage now described as a SQLite database with updated default paths per OS; clarified application logs location; introduced LANGFLOW_DATABASE_URL and LANGFLOW_CONFIG_DIR; removed LANGFLOW_LOG_FILE guidance.
    • Overhauled Logging docs: switched to structlog with JSON output; added real-time viewing instructions; emphasized config via LANGFLOW_CONFIG_DIR; updated env vars (LOG_ENV options, PRETTY_LOGS, LOG_FORMAT); removed LOG_ROTATION.

@mendonk mendonk self-assigned this Sep 9, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 9, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Documentation 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

Cohort / File(s) Summary
Component storage path references
docs/docs/Components/components-processing.mdx
Updated default save location from internal .langflow path to Langflow data directory; adjusted examples and wording (absolute/relative paths, success message).
Flow storage and configuration
docs/docs/Concepts/concepts-flows.mdx
Replaced cache-based storage description with SQLite database; updated default DB file paths per install/OS; introduced LANGFLOW_DATABASE_URL; clarified logs as application logs in config dir; removed LANGFLOW_LOG_FILE guidance.
Logging backend and configuration
docs/docs/Develop/logging.mdx
Switched reference from loguru to structlog; logs in JSON with structured metadata; centralized under LANGFLOW_CONFIG_DIR; added real-time viewing section; updated env vars (LANGFLOW_CONFIG_DIR, LOG_ENV options, PRETTY_LOGS, LOG_FORMAT), removed LOG_ROTATION.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • docs: user feedback items #9122 — Also updates docs to clarify that flow-related data is stored in a SQLite database and adjusts related configuration/env var guidance.

Suggested labels

documentation, size:XL, lgtm

Suggested reviewers

  • italojohnny
  • aimurphy

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “docs: structlog replacing loguru” accurately describes the logging backend change documented in this pull request but omits the significant updates to storage paths and database-backed flow storage, making it only partially representative of the overall changes.
Description Check ✅ Passed The description clearly outlines that the pull request updates both storage and logging documentation, listing key changes such as replacing loguru with structlog, adding tailing examples, and documenting database-backed storage for flows, which aligns directly with the changes in the diff.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs-migrate-to-structlog

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 9, 2025
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 9, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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\logs

If 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.csv
docs/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

📥 Commits

Reviewing files that changed from the base of the PR and between 4144d76 and ad3e676.

📒 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.mdx
  • docs/docs/Develop/logging.mdx
  • docs/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.mdx
  • 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: 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: Confirm LANGFLOW_LOG_FILE and container_json alias 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.

Comment thread docs/docs/Concepts/concepts-flows.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Components/components-processing.mdx Outdated
Comment thread docs/docs/Components/components-processing.mdx Outdated
Comment thread docs/docs/Components/components-processing.mdx Outdated
Comment thread docs/docs/Concepts/concepts-flows.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 10, 2025
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 10, 2025
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 10, 2025
@github-actions

This comment has been minimized.

@mendonk mendonk requested a review from aimurphy September 10, 2025 19:37
@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Sep 10, 2025
Copy link
Copy Markdown
Collaborator

@aimurphy aimurphy left a comment

Choose a reason for hiding this comment

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

One Windows/*nix path seems to be missing, and there is mismatch in the real-time logs tabs.

Comment thread docs/docs/Concepts/concepts-flows.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx Outdated
Comment thread docs/docs/Develop/logging.mdx
@github-actions github-actions Bot removed the lgtm This PR has been approved by a maintainer label Sep 10, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 11, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 11, 2025
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 11, 2025
@mendonk mendonk requested a review from aimurphy September 11, 2025 21:09
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Collaborator

@aimurphy aimurphy left a comment

Choose a reason for hiding this comment

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

approved with just a couple small things

Comment thread docs/docs/Develop/logging.mdx Outdated

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`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment thread docs/docs/_partial-config-dir-paths.mdx Outdated
Comment thread docs/docs/_partial-config-dir-paths.mdx Outdated
@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Sep 11, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 12, 2025
@github-actions

This comment has been minimized.

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 12, 2025
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 12, 2025
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 12, 2025

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

@mendonk mendonk added this pull request to the merge queue Sep 12, 2025
Merged via the queue into main with commit d01ef23 Sep 12, 2025
16 checks passed
@mendonk mendonk deleted the docs-migrate-to-structlog branch September 12, 2025 19:12
lucaseduoli pushed a commit that referenced this pull request Sep 16, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants