Skip to content

HashLoad/horse-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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

../horse-logger/src

✔️ Compatibility

This middleware is compatible with projects developed in:

  • Delphi
  • 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:

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.

About

Middleware for access logging in HORSE

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages