Skip to content

Conversation

Mivik
Copy link
Contributor

@Mivik Mivik commented Jul 23, 2025

This PR adds two options: -f/--follow and -n/--tail to dora logs. These options behave similarly to their counterparts from docker container logs.

Explanation

The -f/--follow option allows users to stream logs in real-time from the daemon. This provides a continuous, live view, similar to how one might "attach" to the daemon's output.

The -n/--tail option allows users to specify the number of historical log lines to display from the end of the log output. This could limit excessive output from the command.

Other modifications

Prior to this PR, logs were printed using bat. While bat offers a wide range of features such as syntax highlighting and Git integration, only its paging functionality was ever utilized. Furthermore, the paging feature itself seems inconsistent and I can't make it work on my machine. Given these limitations, this PR removes the bat dependency and now simply prints all logs directly to the console, allowing users to leverage their preferred pager for viewing, mirroring Docker's approach.

Copy link
Collaborator

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, this is definitely useful!

.build()
.filter();

// subscribe to log messages
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using this approach we might miss log messages that happened in between the Logs and LogSubcribe requests, right? It would probably be better to do this in a single step, e.g. by extending the LogSubscribe message with the option to return old logs from file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if it's handled within one coordinator command, missing logs are hard to avoid (between retrieving logs from file and receiving logs from daemon). A feasible method is to attach a timestamp to each log message, and start receiving log events before reading log files then remove duplicates according timestamp. However it would increase transportation overhead. What do you think?

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