TConfiguratorUnit.pas 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {
  2. Copyright 2005-2006 Log4Delphi Project
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. }
  13. {*----------------------------------------------------------------------------
  14. Contains the configuration procedures used to configure the Log4Delphi
  15. package.
  16. @version 0.5
  17. @author <a href="mailto:tcmiller@users.sourceforge.net">Trevor Miller</a>
  18. ----------------------------------------------------------------------------}
  19. unit TConfiguratorUnit;
  20. {$ifdef fpc}
  21. {$mode objfpc}
  22. {$h+}
  23. {$endif}
  24. interface
  25. uses
  26. SysUtils, Forms,
  27. TLogLogUnit, TlevelUnit, TLoggerUnit,
  28. TPropertyConfiguratorUnit,
  29. TIniConfiguratorUnit;
  30. procedure doBasicConfiguration;
  31. procedure doPropertiesConfiguration(const fileName : String);
  32. procedure doIniConfiguration(const fileName, sectionName : String);
  33. implementation
  34. {*----------------------------------------------------------------------------
  35. Use this method to quickly configure the logging suite.
  36. ----------------------------------------------------------------------------}
  37. procedure doBasicConfiguration;
  38. begin
  39. TlogLogUnit.initialize(ExtractFileDir(Application.ExeName)
  40. + '\log4delphi.log');
  41. //LoggerUnit.initialize();
  42. end;
  43. {*----------------------------------------------------------------------------
  44. This method performs a basic configuration and then configures the
  45. package based on the properties specified in the properties file.
  46. ----------------------------------------------------------------------------}
  47. procedure doPropertiesConfiguration(const fileName : String);
  48. begin
  49. //TLoggerUnit.initialize();
  50. TPropertyConfiguratorUnit.DoConfigure(fileName);
  51. end;
  52. {*----------------------------------------------------------------------------
  53. This method performs a basic configuration and then configures the
  54. package based on the properties specified in the ini file section.
  55. ----------------------------------------------------------------------------}
  56. procedure doIniConfiguration(const fileName, sectionName : String);
  57. begin
  58. //TLoggerUnit.initialize();
  59. TIniConfiguratorUnit.DoConfigure(fileName, sectionName);
  60. end;
  61. end.