Comment #6 on issue 360 by DeonWu: Possibility to view log file without
loading it into memory fully
http://code.google.com/p/robotframework/issues/detail?id=360
A pure javascripts solution, A known limitation, It required to view log
from web server in newest browser(like IE8, Chrome). If the HTML file is
in local, The browser totally forbid javascript to load other HTML because
of the security policy. But it works with warning in IE6 and firefox 2.x.
Other enhancement in this javascript, It support to change the log level of
HTML view by select box. the pybot can always running with trace log level,
and to switch the html log level in the browser dynamical.
The loading log function, that changed the "toggle_visibility" function of
robot. See source code:
============================================
var init_logviewer = function(){
if(inited_logviewer) return;
inited_logviewer = true;
var _orgin_toggle_visibility = toggle_visibility;
toggle_visibility = function(element_id){
_orgin_toggle_visibility(element_id);
if (/_children$/.test(element_id)) {
var element = document.getElementById(element_id)
if (element.style.display == 'block') {
search_child_link_and_load(element);
}
}
}
}
============================================
The log level filter box is injected at the file loading. see source code:
============================================
function init_applet(){
if (!select) {
select = document.createElement("div");
strIframe = '<select name="select" id="select_level" style="float:right;"
onchange = "set_level(this.value)"><option value="0">TRACE</option><option
value="1">DEBUG</option><option value="2">INFO</option><option
value="3">WARN</option></select>';
select.innerHTML = strIframe;
select.style['position'] = 'absolute';
select.style['top'] = '20px';
select.style['right'] = '20px';
var main = document.getElementsByTagName('body')[0];
main.insertBefore(select, main.firstChild);
document.getElementById("select_level").value = "2";
onEvent(window, "scroll", on_scroll);
init_message_list();
find_all_types_message(document)
}
=============================================
Attachments:
log_viewer.js 7.4 KB