debug.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. logger_parameter = {};
  2. function logger_init() {
  3. $('#result').html('');
  4. $('#content').html('');
  5. var str = '<table border="1" width="100%">';
  6. str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp<a href="#" id="trace">trace</a>&nbsp;<a href="#" id="debug">debug</a>&nbsp;<a href="#" id="info">info</a>&nbsp;<a href="#" id="warn">warn</a></td></tr>';
  7. str += '<tr><td>debug:</td><td id="level">&nbsp;</td></tr>';
  8. str += '</table>';
  9. $('#content').html(str);
  10. $('#get').click(function() {
  11. logger_get();
  12. });
  13. $('#trace').click(function() {
  14. logger_trace();
  15. });
  16. $('#debug').click(function() {
  17. logger_debug();
  18. });
  19. $('#info').click(function() {
  20. logger_info();
  21. });
  22. $('#warn').click(function() {
  23. logger_warn();
  24. });
  25. }
  26. function logger_get() {
  27. $.ajax({
  28. type : 'get',
  29. dataType : 'json',
  30. url : '../jaxrs/logger',
  31. contentType : 'application/json; charset=utf-8',
  32. xhrFields : {
  33. 'withCredentials' : true
  34. },
  35. crossDomain : true
  36. }).done(function(json) {
  37. if (json.type == 'success') {
  38. $('#level').html(json.data.value);
  39. }
  40. }).always(function(json) {
  41. $('#result').html(JSON.stringify(json, null, 4));
  42. });
  43. }
  44. function debug_trace() {
  45. $.ajax({
  46. type : 'get',
  47. dataType : 'json',
  48. url : '../jaxrs/logger/trace',
  49. contentType : 'application/json; charset=utf-8',
  50. xhrFields : {
  51. 'withCredentials' : true
  52. },
  53. crossDomain : true
  54. }).always(function(json) {
  55. $('#result').html(JSON.stringify(json, null, 4));
  56. });
  57. }
  58. function debug_debug() {
  59. $.ajax({
  60. type : 'get',
  61. dataType : 'json',
  62. url : '../jaxrs/logger/debug',
  63. contentType : 'application/json; charset=utf-8',
  64. xhrFields : {
  65. 'withCredentials' : true
  66. },
  67. crossDomain : true
  68. }).always(function(json) {
  69. $('#result').html(JSON.stringify(json, null, 4));
  70. });
  71. }
  72. function debug_info() {
  73. $.ajax({
  74. type : 'get',
  75. dataType : 'json',
  76. url : '../jaxrs/logger/info',
  77. contentType : 'application/json; charset=utf-8',
  78. xhrFields : {
  79. 'withCredentials' : true
  80. },
  81. crossDomain : true
  82. }).always(function(json) {
  83. $('#result').html(JSON.stringify(json, null, 4));
  84. });
  85. }
  86. function debug_warn() {
  87. $.ajax({
  88. type : 'get',
  89. dataType : 'json',
  90. url : '../jaxrs/logger/warn',
  91. contentType : 'application/json; charset=utf-8',
  92. xhrFields : {
  93. 'withCredentials' : true
  94. },
  95. crossDomain : true
  96. }).always(function(json) {
  97. $('#result').html(JSON.stringify(json, null, 4));
  98. });
  99. }