当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Make long log data diplayed with PHP easy to read

问题描述:

I have a long log file I am displaying with PHP. Its getting too long for me and I have to use CTRL+F to look at this thing in any way. What is a good way to display this data in a way easy to read?

Best way would be using jquery.

网友答案:

Since your problem seems to be client-side searching-and-filtering your log (since you use a lot of Ctrl+F), you could use the quicksearch jquery plugin (see the example on the page).

Now in the examples, the plugin filters table rows, but I believe you could also use it to filter other type of elements, such as <p>log message</p>. Just wrap individual messages in an appropriate html element, and then filter them.

网友答案:

Probably in a tabular format. Personally, jQuery + dataTables (jQuery plugin) works really well for most applications where you can sort out times and types of messages and such. dataTables would allow you to say, view 100 per page and sort by it.

网友答案:

Define 'long'. Is the data being displayed in a very long string that makes you scroll horizontally?

If so you could try breaking it down using something like:

echo nl2br($very_long_log_file);

which will put a <br/> before all new lines.

网友答案:

You could provide an interactive "search" field at the top that would filter the long list of lines to show only the lines matching the search criteria. This could be done on the client side with using jQuery which would avoid a round-trip to the server.

分享给朋友:
您可能感兴趣的文章:
随机阅读: