HttpServerService.Logger.pas 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. unit HttpServerService.Logger;
  2. interface
  3. uses
  4. System.SysUtils,
  5. Quick.Logger.Intf,
  6. Quick.Logger,
  7. Quick.Logger.Provider.Console;
  8. type
  9. TQuickLogger = class(TInterfacedObject,ILogger)
  10. public
  11. procedure Init;
  12. procedure Info(const aMsg : string); overload;
  13. procedure Info(const aMsg : string; aValues : array of const); overload;
  14. procedure Succ(const aMsg : string); overload;
  15. procedure Succ(const aMsg : string; aParams : array of const); overload;
  16. procedure Done(const aMsg : string); overload;
  17. procedure Done(const aMsg : string; aValues : array of const); overload;
  18. procedure Warn(const aMsg : string); overload;
  19. procedure Warn(const aMsg : string; aValues : array of const); overload;
  20. procedure Error(const aMsg : string); overload;
  21. procedure Error(const aMsg : string; aValues : array of const); overload;
  22. procedure Critical(const aMsg : string); overload;
  23. procedure Critical(const aMsg : string; aValues : array of const); overload;
  24. procedure Trace(const aMsg : string); overload;
  25. procedure Trace(const aMsg : string; aValues : array of const); overload;
  26. procedure Debug(const aMsg : string); overload;
  27. procedure Debug(const aMsg : string; aValues : array of const); overload;
  28. procedure &Except(const aMsg : string; aValues : array of const); overload;
  29. procedure &Except(const aMsg, aException, aStackTrace : string); overload;
  30. procedure &Except(const aMsg : string; aValues: array of const; const aException, aStackTrace: string); overload;
  31. end;
  32. implementation
  33. { TQuickLogger }
  34. procedure TQuickLogger.Init;
  35. begin
  36. GlobalLogConsoleProvider.LogLevel := LOG_DEBUG;
  37. Logger.Providers.Add(GlobalLogConsoleProvider);
  38. GlobalLogConsoleProvider.Enabled := True;
  39. end;
  40. procedure TQuickLogger.Info(const aMsg: string);
  41. begin
  42. Logger.Info(aMsg);
  43. end;
  44. procedure TQuickLogger.Info(const aMsg: string; aValues: array of const);
  45. begin
  46. Logger.Info(aMsg,aValues);
  47. end;
  48. procedure TQuickLogger.Succ(const aMsg: string);
  49. begin
  50. Logger.Succ(aMsg);
  51. end;
  52. procedure TQuickLogger.Succ(const aMsg: string; aParams: array of const);
  53. begin
  54. Logger.Succ(aMsg,aParams);
  55. end;
  56. procedure TQuickLogger.Done(const aMsg: string);
  57. begin
  58. Logger.Done(aMsg);
  59. end;
  60. procedure TQuickLogger.Done(const aMsg: string; aValues: array of const);
  61. begin
  62. Logger.Done(aMsg,aValues);
  63. end;
  64. procedure TQuickLogger.Warn(const aMsg: string);
  65. begin
  66. Logger.Warn(aMsg);
  67. end;
  68. procedure TQuickLogger.Warn(const aMsg: string; aValues: array of const);
  69. begin
  70. Logger.Warn(aMsg,aValues);
  71. end;
  72. procedure TQuickLogger.Error(const aMsg: string);
  73. begin
  74. Logger.Error(aMsg);
  75. end;
  76. procedure TQuickLogger.Error(const aMsg: string; aValues: array of const);
  77. begin
  78. Logger.Error(aMsg,aValues);
  79. end;
  80. procedure TQuickLogger.Critical(const aMsg: string);
  81. begin
  82. Logger.Critical(aMsg);
  83. end;
  84. procedure TQuickLogger.Critical(const aMsg: string; aValues: array of const);
  85. begin
  86. Logger.Critical(aMsg,aValues);
  87. end;
  88. procedure TQuickLogger.Trace(const aMsg: string);
  89. begin
  90. Logger.Trace(aMsg);
  91. end;
  92. procedure TQuickLogger.Trace(const aMsg: string; aValues: array of const);
  93. begin
  94. Logger.Trace(aMsg,aValues);
  95. end;
  96. procedure TQuickLogger.Debug(const aMsg: string);
  97. begin
  98. Logger.Debug(aMsg);
  99. end;
  100. procedure TQuickLogger.Debug(const aMsg: string; aValues: array of const);
  101. begin
  102. Logger.Debug(aMsg,aValues);
  103. end;
  104. procedure TQuickLogger.&Except(const aMsg: string; aValues: array of const);
  105. begin
  106. Logger.&Except(aMsg,aValues);
  107. end;
  108. procedure TQuickLogger.&Except(const aMsg: string; aValues: array of const; const aException, aStackTrace: string);
  109. begin
  110. Logger.&Except(aMsg,aValues,aException,aStacktrace);
  111. end;
  112. procedure TQuickLogger.&Except(const aMsg, aException, aStackTrace: string);
  113. begin
  114. Logger.&Except(aMsg,aException,aStackTrace);
  115. end;
  116. end.