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 is done using the boss install command:
boss install horse-loggerIf 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
../horse-logger/src
This middleware is compatible with projects developed in:
- Delphi
- Lazarus
| Provider | Delphi | Lazarus |
|---|---|---|
| console | ✔️ | ✔️ |
| file | ✔️ | ✔️ |
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.
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.horse-logger is free and open-source middleware licensed under the MIT License.