logdyhq / logdy-core

Web based real-time log viewer. Stream ANY content to a web UI with autogenerated filters. Parse any format with TypeScript.

Home Page:https://logdy.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] how to other UI other than lodgy-ui

EtainLove opened this issue · comments

Thank you for the awesome logging tool.

I have a question as stated in the title.

is there any way to use other UI framework other than Vue (logdy-ui)?

I would like to use my own frontend to display PM2 logs.

I looked into the logdy-core to know how the logdy-core commuicates with the logdy-ui, but I could not find it out.

Could you explain how I can use my own frontend? To my knowledge, websocket should be involved. Any guide will be helpful.

updates

I connected to th elogdy-core through ws://localhost:8080/ws

at first I got log_bulk messages and then client_msg_status periodically.

even though I created a message on the server, my own frontedend has not received the message except the 'client_msg_status'.

In contrast, the logdy-ui received the messages correctly (it seems that the 'client_msg_status' message is not displayed intentionally in the ui code)

It is strange that my own frontend has not received the log messages other than the 'client_msg_status'.

Hi @EtainLove,
thanks for taking interest in Logdy. Connecting they way you do is exactly right, there is just one caveat. You should send should_follow=true in the query to signal the server that it should start streaming the messages through websocket immediately. The full URL to connect to WS should look like this: 127.0.0.1:8080/ws?should_follow=true (I just tried with logdy demo and connected through Postman)

See the line here, it joins the client and starts streaming.

ch := clients.Join(100, r.URL.Query().Get("should_follow") == "true")

Here you can see the endpoints for controlling the log streaming (pause/resume/peek)

logdy-core/http.go

Lines 363 to 365 in 3499273

http.HandleFunc("/api/client/set-status", handleClientStatus(clients))
http.HandleFunc("/api/client/load", handleClientLoad(clients))
http.HandleFunc("/api/client/peek-log", handleClientPeek(clients))

Can you share more about your use case? I'm really interested in hearing more.
Cheers, Peter

Thnk you for the detailed explanation. I tried the way you guided and it works!

Initially I used the logdy-ui in a webview in my Flutter web app. But I need to handle the click event of a log message but the webview package for the flutter web is not allowed to receive a message from logdy-ui.

I love the logdy-ui but this is why I had to connect to the logdy-core directly to get log messages.

By the way, the log messages are from pm2 logs.

I will close this issue since it is resolved.