Logger_frMain.pas 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. (* _ _
  2. * | |__ _ __ ___ ___ | | __
  3. * | '_ \| '__/ _ \ / _ \| |/ /
  4. * | |_) | | | (_) | (_) | <
  5. * |_.__/|_| \___/ \___/|_|\_\
  6. *
  7. * Microframework which helps to develop web Pascal applications.
  8. *
  9. * Copyright (c) 2012-2021 Silvio Clecio <[email protected]>
  10. *
  11. * Brook framework is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation; either
  14. * version 2.1 of the License, or (at your option) any later version.
  15. *
  16. * Brook framework is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with Brook framework; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *)
  25. { This example show a basic usage of TBrookLogger. }
  26. unit Logger_frMain;
  27. interface
  28. uses
  29. System.SysUtils,
  30. System.Classes,
  31. FMX.Types,
  32. FMX.StdCtrls,
  33. FMX.Controls,
  34. FMX.Edit,
  35. FMX.Controls.Presentation,
  36. FMX.Forms,
  37. BrookLogger;
  38. type
  39. TfrMain = class(TForm)
  40. BrookLogger1: TBrookLogger;
  41. pnLog: TPanel;
  42. btAppendLog: TButton;
  43. lbLog: TLabel;
  44. edLog: TEdit;
  45. procedure FormCreate(Sender: TObject);
  46. procedure btAppendLogClick(Sender: TObject);
  47. end;
  48. var
  49. frMain: TfrMain;
  50. implementation
  51. {$R *.fmx}
  52. procedure TfrMain.FormCreate(Sender: TObject);
  53. begin
  54. BrookLogger1.OutputName := 'File';
  55. BrookLogger1.Options.Values['Directory'] := ExtractFileDir(ParamStr(0));
  56. BrookLogger1.Open;
  57. end;
  58. procedure TfrMain.btAppendLogClick(Sender: TObject);
  59. begin
  60. BrookLogger1.Warn(edLog.Text);
  61. end;
  62. end.