Skip to content

Commit

Permalink
New version
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosHe committed Feb 2, 2021
1 parent a7a57e9 commit 05667ee
Show file tree
Hide file tree
Showing 15 changed files with 494 additions and 2,503 deletions.
33 changes: 0 additions & 33 deletions HorseLogger.dpk

This file was deleted.

982 changes: 0 additions & 982 deletions HorseLogger.dproj

This file was deleted.

39 changes: 13 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,21 @@ Middleware for access logging in HORSE
$ boss install horse-logger
```

### Format
`Format` defines the logging format with defined variables
Values sent to providers: `time`,`execution_time`,`request_clientip`,`request_method`,`request_version`,`request_url`,`request_query`,`request_path_info`,`request_path_translated`,`request_cookie`,`request_accept`,`request_from`,`request_host`,`request_referer`,`request_user_agent`,`request_connection`,`request_derived_from`,`request_remote_addr`,`request_remote_host`,`request_script_name`,`request_server_port`,`request_remote_ip`,`request_internal_path_info`,`request_raw_path_info`,`request_cache_control`,`request_script_name`,`request_authorization`,`request_content_encoding`,`request_content_type`,`request_content_length`,`request_content_version`,`response_version`,`response_reason`,`response_server`,`response_realm`,`response_allow`,`response_location`,`response_log_message`,`response_title`,`response_content_encoding`,`response_content_type`,`response_content_length`,`response_content_version`,`response_status`

Default: `${request_clientip} [${time}] ${request_user_agent} "${request_method} ${request_path_info} ${request_version}" ${response_status} ${response_content_length}`
### Sample Horse Logger

Possible values: `time`,`execution_time`,`request_clientip`,`request_method`,`request_version`,`request_url`,`request_query`,`request_path_info`,`request_path_translated`,`request_cookie`,`request_accept`,`request_from`,`request_host`,`request_referer`,`request_user_agent`,`request_connection`,`request_derived_from`,`request_remote_addr`,`request_remote_host`,`request_script_name`,`request_server_port`,`request_remote_ip`,`request_internal_path_info`,`request_raw_path_info`,`request_cache_control`,`request_script_name`,`request_authorization`,`request_content_encoding`,`request_content_type`,`request_content_length`,`request_content_version`,`response_version`,`response_reason`,`response_server`,`response_realm`,`response_allow`,`response_location`,`response_log_message`,`response_title`,`response_content_encoding`,`response_content_type`,`response_content_length`,`response_content_version`,`response_status`
Needs to install the logfile provider for the sample to work correctly.
Run: boss install horse-logger-provider-logfile

Sample Horse Logger
```delphi
uses Horse, Horse.Logger;
uses Horse, Horse.Logger, Horse.Logger.Provider.LogFile;
begin
THorse.Use(THorseLogger.New());
THorse.Post('/ping',
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
begin
Res.Send('pong');
end);
THorse.Listen(9000);
end.
```

Sample Horse Logger with custom log format and log folder
```delphi
uses Horse, Horse.Logger;
var
HorseLoggerConfig: THorseLoggerConfig;
THorseLoggerManager.RegisterProvider( THorseLoggerProviderLogFile.New() );
begin
HorseLoggerConfig := THorseLoggerConfig.Create('${time} - ${request_method} ${request_path_info}', '/var/log/horse');
THorse.Use(THorseLogger.New(HorseLoggerConfig));
THorse.Use( THorseLoggerManager.HorseCallback() );
THorse.Post('/ping',
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
Expand All @@ -48,5 +29,11 @@ begin
end);
THorse.Listen(9000);
end.
```

### Official providers

- [Console](https://github.com/HashLoad/horse-logger-provider-console)
- [LogFile](https://github.com/HashLoad/horse-logger-provider-logfile)
6 changes: 3 additions & 3 deletions boss-lock.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"hash": "e418299cf5cb8b234a6a93d8c623f08b",
"updated": "2021-01-29T09:36:44.7160294-03:00",
"updated": "2021-02-02T10:18:23.3844853-03:00",
"installedModules": {
"github.com/dliocode/horse-utils-clientip": {
"name": "horse-utils-clientip",
"version": "0.0.5",
"hash": "e70e774b0e0e7248d1e9028fc9c4542e",
"version": "0.0.6",
"hash": "db4c16721abe55f9f8c42c7990101361",
"artifacts": {},
"failed": false,
"changed": false
Expand Down
4 changes: 2 additions & 2 deletions boss.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "horse-logger",
"description": "Middleware for access logging in HORSE",
"version": "1.0.0",
"version": "2.0.0",
"homepage": "https://github.com/HashLoad/horse-logger",
"mainsrc": "./src/",
"projects": [],
"dependencies": {
"github.com/dliocode/horse-utils-clientip": "^0.0.5",
"github.com/dliocode/horse-utils-clientip": "^0.0.6",
"github.com/hashload/horse": "^2.0.10"
}
}
22 changes: 0 additions & 22 deletions samples/boss-lock.json

This file was deleted.

12 changes: 0 additions & 12 deletions samples/boss.json

This file was deleted.

18 changes: 0 additions & 18 deletions samples/samples.dpr

This file was deleted.

Loading

0 comments on commit 05667ee

Please sign in to comment.