Log viewer is a jQuery plugin that shows file contents in a web browser. File contents are fetched from the last changed position, so it can be used to stream large amount of changes without having to fetch large amounts of data each time.
Log viewer needs a real web server to operate. It uses AJAX to get updated file contents with a positioned HEAD request that gets the file size and fetches only the bytes added since the last change to the file.
LogViewer comes with an instruction page - index.html.
To run logViewer you need to include jQuery library first, then the logViewer plugin in <script> tags.
Log viewer options: - logUrl - web location of desired log file - refreshtimeout - refresh interval in ms - readBytes - initional amount of bytes to fetch - callback - user function to call to modify new content if necessary before it is appended to log window. The callback receives new content as a single argument and must return it.
Example usage
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="jquery.logviewer.js"></script>
<script type="text/javascript">
jQuery(document).bind("ready", function() {
jQuery('#logcontent').logViewer({logUrl: 'log.html'});
});
</script>
</head>
<body>
Live log:<br/>
<textarea id="logcontent" autocomplete="off">
Works as expected. File delivered as a zip file but was intact rar which caused some unnecessary difficulties.
Very nice little script. Works flawlessly on every browser Ive tested. THANKS!
good
Questions & Comments