Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

horse-logger

Middleware for access logging in HORSE

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

horse-logger

horse-logger is an official middleware for logging in APIs developed with the Horse framework.

We created a channel on Telegram for questions and support:

⚙️ Installation

Installation is done using the boss install command:

bash
boss install horse-logger

If you choose to install manually, simply add the following folders to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path

pascal
../horse-logger/src

✔️ Compatibility

This middleware is compatible with projects developed in:

  • [X] Delphi
  • [X] Lazarus

🧬 Official Providers

Provider Delphi Lazarus
console    ✔️     ✔️
file    ✔️     ✔️

⚡️ Quickstart & Samples

We provide a complete, real-life sample project showing how to integrate horse-logger with a custom text file log provider and handle exceptions globally. You can find it in the samples/ folder.

Registering custom providers and handling logging errors:

delphi
uses
  Horse,
  Horse.Logger.Manager,
  Horse.Logger.Provider.Contract;

begin
  // Set global handler for logging errors (optional but recommended)
  THorseLoggerManager.OnError := procedure(const AProvider: IHorseLoggerProvider; const AException: Exception)
    begin
      Writeln('Log Provider ' + AProvider.ClassName + ' failed: ' + AException.Message);
    end;

  // Register your custom providers
  THorseLoggerManager.RegisterProvider(TMyCustomLogProvider.Create);

  // Enable middleware
  THorse.Use(THorseLoggerManager.HorseCallback);

  THorse.Listen(9000);
end.

⚠️ License

horse-logger is free and open-source middleware licensed under the MIT License.