srs.log.js 1.1 KB

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