Skip to content

Conversation

@appflowy
Copy link
Contributor

@appflowy appflowy commented Nov 26, 2025

Description


Checklist

General

  • I've included relevant documentation or comments for the changes introduced.
  • I've tested the changes in multiple environments (e.g., different browsers, operating systems).

Testing

  • I've added or updated tests to validate the changes introduced for AppFlowy Web.

Feature-Specific

  • For feature additions, I've added a preview (video, screenshot, or demo) in the "Feature Preview" section.
  • I've verified that this feature integrates seamlessly with existing functionality.

Summary by Sourcery

Adjust server logging behavior and add a startup version banner for the SSR Docker container.

Enhancements:

  • Disable pretty logging in production while retaining structured logging based on environment.
  • Reduce log noise by skipping request logs for health check endpoints.

Deployment:

  • Print an AppFlowy Web version banner on startup of the SSR Docker container for easier runtime identification.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 26, 2025

Reviewer's Guide

Configures server logging to avoid verbose output in production and for health checks, and adds a version banner to the SSR Docker entrypoint script.

Sequence diagram for request logging with health-check filtering

sequenceDiagram
  actor Client
  participant Server as createServer
  participant Timer as logRequestTimer
  participant Logger as logger

  Client->>Server: HTTP request
  Server->>Timer: logRequestTimer(req)
  activate Timer
  Timer-->>Server: timer
  deactivate Timer

  alt pathname does not start with /health
    Timer->>Logger: info( Incoming request: pathname )
  else pathname starts with /health
    Timer--x Logger: skip incoming request log
  end

  Server->>Logger: (conditionally) info( Request URL: host + pathname )
  note right of Server: Only if pathname does not start with /health

  Client-->>Server: Response received

  Server->>Timer: timer()
  activate Timer
  alt pathname does not start with /health
    Timer->>Logger: info( Request for pathname took duration ms )
  else pathname starts with /health
    Timer--x Logger: skip duration log
  end
  deactivate Timer
Loading

Flow diagram for SSR Docker entrypoint version banner

flowchart TD
  A[Start entrypoint-ssr.sh] --> B[Print version banner with APP_VERSION or dev]
  B --> C{AF_BASE_URL set and APPFLOWY_BASE_URL empty?}
  C -- Yes --> D[Print deprecation warning for AF_BASE_URL]
  C -- No --> E[Skip deprecation warning]
  D --> F[Continue container startup]
  E --> F[Continue container startup]
  F --> G[Start SSR server process]
  G --> H[End]
Loading

File-Level Changes

Change Details Files
Adjust server logger configuration to use pretty transport only in non-production environments.
  • Extract pretty transport configuration into a separate constant.
  • Conditionally set Pino transport to the pretty transport when NODE_ENV is not 'production'.
  • Keep log level controlled by LOG_LEVEL env var with default 'info'.
deploy/server.ts
Reduce noise from health check requests in server logs.
  • Wrap initial request path logging in a conditional that skips paths starting with '/health'.
  • Wrap request duration logging in a conditional that skips paths starting with '/health'.
  • Guard "Request URL" logs to skip when the path starts with '/health'.
deploy/server.ts
Add an application version banner to the SSR Docker entrypoint logs.
  • Print a decorative banner on container startup showing the AppFlowy Web version from APP_VERSION or 'dev' by default.
  • Ensure the banner appears before other compatibility and configuration messages.
docker/entrypoint-ssr.sh

Possibly linked issues

  • #[Bug] AppFlowy Web wants to log me in to official AppFlowy-Cloud instead of Self-Hosted AppFlowy-Cloud: They match: the PR maps deprecated AF_* env vars to new ones so self-hosted URLs are respected.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The repeated pathname.startsWith('/health') checks in server.ts would be easier to maintain and less error-prone if extracted into a small helper (e.g., isHealthCheck(pathname) or a HEALTH_ENDPOINT constant) used in all logging conditions.
  • Since you’ve introduced a prettyTransport config, consider centralizing logger creation (or at least the transport selection based on NODE_ENV) so any future loggers can reuse the same behavior without duplicating this logic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The repeated `pathname.startsWith('/health')` checks in `server.ts` would be easier to maintain and less error-prone if extracted into a small helper (e.g., `isHealthCheck(pathname)` or a `HEALTH_ENDPOINT` constant) used in all logging conditions.
- Since you’ve introduced a `prettyTransport` config, consider centralizing logger creation (or at least the transport selection based on `NODE_ENV`) so any future loggers can reuse the same behavior without duplicating this logic.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@appflowy appflowy merged commit 7bb809d into main Nov 26, 2025
12 checks passed
@appflowy appflowy deleted the server_log branch November 26, 2025 08:49
josue693 pushed a commit to josue693/AppFlowy-Web that referenced this pull request Dec 21, 2025
* chore: update log

* chore: update log

* chore: redirect log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants