Quick.Logger.Intf.pas 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. { ***************************************************************************
  2. Copyright (c) 2016-2019 Kike Pérez
  3. Unit : Quick.Logger.Intf
  4. Description : Quick Logger Interface
  5. Author : Kike Pérez
  6. Version : 1.8
  7. Created : 30/08/2019
  8. Modified : 11/09/2019
  9. This file is part of QuickLib: https://github.com/exilon/QuickLib
  10. ***************************************************************************
  11. Licensed under the Apache License, Version 2.0 (the "License");
  12. you may not use this file except in compliance with the License.
  13. You may obtain a copy of the License at
  14. http://www.apache.org/licenses/LICENSE-2.0
  15. Unless required by applicable law or agreed to in writing, software
  16. distributed under the License is distributed on an "AS IS" BASIS,
  17. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. See the License for the specific language governing permissions and
  19. limitations under the License.
  20. *************************************************************************** }
  21. unit Quick.Logger.Intf;
  22. {$i QuickLib.inc}
  23. interface
  24. uses
  25. {$IFNDEF FPC}
  26. System.SysUtils;
  27. {$ELSE}
  28. SysUtils;
  29. {$ENDIF}
  30. type
  31. ILogger = interface
  32. ['{1065BB46-7EB8-480A-8B30-ED3B865DDB18}']
  33. procedure Info(const aMsg : string); overload;
  34. procedure Info(const aMsg : string; aParams : array of const); overload;
  35. procedure Succ(const aMsg : string); overload;
  36. procedure Succ(const aMsg : string; aParams : array of const); overload;
  37. procedure Done(const aMsg : string); overload;
  38. procedure Done(const aMsg : string; aParams : array of const); overload;
  39. procedure Warn(const aMsg : string); overload;
  40. procedure Warn(const aMsg : string; aParams : array of const); overload;
  41. procedure Error(const aMsg : string); overload;
  42. procedure Error(const aMsg : string; aParams : array of const); overload;
  43. procedure Critical(const aMsg : string); overload;
  44. procedure Critical(const aMsg : string; aParams : array of const); overload;
  45. procedure Trace(const aMsg : string); overload;
  46. procedure Trace(const aMsg : string; aParams : array of const); overload;
  47. procedure Debug(const aMsg : string); overload;
  48. procedure Debug(const aMsg : string; aParams : array of const); overload;
  49. procedure &Except(const aMsg : string; aValues : array of const); overload;
  50. procedure &Except(const aMsg, aException, aStackTrace : string); overload;
  51. procedure &Except(const aMsg : string; aValues: array of const; const aException, aStackTrace: string); overload;
  52. end;
  53. TNullLogger = class(TInterfacedObject,ILogger)
  54. procedure Info(const aMsg : string); overload;
  55. procedure Info(const aMsg : string; aParams : array of const); overload;
  56. procedure Succ(const aMsg : string); overload;
  57. procedure Succ(const aMsg : string; aParams : array of const); overload;
  58. procedure Done(const aMsg : string); overload;
  59. procedure Done(const aMsg : string; aParams : array of const); overload;
  60. procedure Warn(const aMsg : string); overload;
  61. procedure Warn(const aMsg : string; aParams : array of const); overload;
  62. procedure Error(const aMsg : string); overload;
  63. procedure Error(const aMsg : string; aParams : array of const); overload;
  64. procedure Critical(const aMsg : string); overload;
  65. procedure Critical(const aMsg : string; aParams : array of const); overload;
  66. procedure Trace(const aMsg : string); overload;
  67. procedure Trace(const aMsg : string; aParams : array of const); overload;
  68. procedure Debug(const aMsg : string); overload;
  69. procedure Debug(const aMsg : string; aParams : array of const); overload;
  70. procedure &Except(const aMsg : string; aValues : array of const); overload;
  71. procedure &Except(const aMsg, aException, aStackTrace : string); overload;
  72. procedure &Except(const aMsg : string; aValues: array of const; const aException, aStackTrace: string); overload;
  73. procedure &Except(MsgObject : TObject); overload;
  74. end;
  75. implementation
  76. { TNullLogger }
  77. procedure TNullLogger.Info(const aMsg: string);
  78. begin
  79. end;
  80. procedure TNullLogger.Info(const aMsg: string; aParams: array of const);
  81. begin
  82. end;
  83. procedure TNullLogger.Succ(const aMsg: string; aParams: array of const);
  84. begin
  85. end;
  86. procedure TNullLogger.Succ(const aMsg: string);
  87. begin
  88. end;
  89. procedure TNullLogger.Done(const aMsg: string);
  90. begin
  91. end;
  92. procedure TNullLogger.Debug(const aMsg: string; aParams: array of const);
  93. begin
  94. end;
  95. procedure TNullLogger.Done(const aMsg: string; aParams: array of const);
  96. begin
  97. end;
  98. procedure TNullLogger.Warn(const aMsg: string);
  99. begin
  100. end;
  101. procedure TNullLogger.Warn(const aMsg: string; aParams: array of const);
  102. begin
  103. end;
  104. procedure TNullLogger.Error(const aMsg: string);
  105. begin
  106. end;
  107. procedure TNullLogger.Error(const aMsg: string; aParams: array of const);
  108. begin
  109. end;
  110. procedure TNullLogger.Critical(const aMsg: string);
  111. begin
  112. end;
  113. procedure TNullLogger.&Except(MsgObject: TObject);
  114. begin
  115. end;
  116. procedure TNullLogger.Critical(const aMsg: string; aParams: array of const);
  117. begin
  118. end;
  119. procedure TNullLogger.Trace(const aMsg: string);
  120. begin
  121. end;
  122. procedure TNullLogger.Trace(const aMsg: string; aParams: array of const);
  123. begin
  124. end;
  125. procedure TNullLogger.Debug(const aMsg: string);
  126. begin
  127. end;
  128. procedure TNullLogger.&Except(const aMsg: string; aValues: array of const);
  129. begin
  130. end;
  131. procedure TNullLogger.&Except(const aMsg: string; aValues: array of const; const aException, aStackTrace: string);
  132. begin
  133. end;
  134. procedure TNullLogger.&Except(const aMsg, aException, aStackTrace: string);
  135. begin
  136. end;
  137. end.