Jump to content

[HELP] Show console logs on the web using PHPSDK


AaroN⍩

Recommended Posts

On 22/08/2020 at 01:27, AaroN⍩ said:

Hi, I hope someone can help me with this question, I would like to display the latest server logs on a website using PHPSDK but I have a question on how to do it efficiently as it will update in real time. any ideas?

I'm not sure if it's possible to achieve real time with just PHP.
Maybe you can use socket that can be listened with javascript client.

Link to comment
  • Discord Moderators

You can open a file handle on server.log and read it periodically. Move the pointer to end of file after opening it initially, and read from it at some interval (500ms should feel like realtime).

Link to comment
  • 3 months later...
On 28/08/2020 at 09:37, Zango said:

You can open a file handle on server.log and read it periodically. Move the pointer to end of file after opening it initially, and read from it at some interval (500ms should feel like realtime).

Initially I did it like this, but it is not efficient since you have to count the lines of the server.log and then take the last 20 lines, for example, and do it every 5 seconds is 0 efficient.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...