Blame view

trunk/research/players/js/srs.log.js 1.1 KB
1 2 3 4 5 6 7 8 9
/**
* log specified, there must be a log element as:
    <!-- for the log -->
    <div class="alert alert-info fade in" id="txt_log">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong><span id="txt_log_title">标题:</span></strong>
        <span id="txt_log_msg">日志内容</span>
    </div>
*/
10
var srs_log_disabled = false;
11
function info(desc) {
12 13 14 15
    if (srs_log_disabled) {
        return;
    }
    
16 17
    $("#txt_log").addClass("alert-info").removeClass("alert-error").removeClass("alert-warn");
    $("#txt_log_title").text("Info:");
18
    $("#txt_log_msg").html(desc);
19 20
}
function warn(code, desc) {
21 22 23 24
    if (srs_log_disabled) {
        return;
    }
    
25 26
    $("#txt_log").removeClass("alert-info").removeClass("alert-error").addClass("alert-warn");
    $("#txt_log_title").text("Warn:");
27
    $("#txt_log_msg").html("code: " + code + ", " + desc);
28 29
}
function error(code, desc) {
30 31 32 33
    if (srs_log_disabled) {
        return;
    }
    
34 35
    $("#txt_log").removeClass("alert-info").addClass("alert-error").removeClass("alert-warn");
    $("#txt_log_title").text("Error:");
36
    $("#txt_log_msg").html("code: " + code + ", " + desc);
37
}