Martti T
a842444e8f
Add SPDX licence comments to files. See https://spdx.dev/learn/handling-license-info/ ( #2604 )
2024-03-09 11:21:24 +02:00
Kanji Yomoda
135c511f5d
Add request route with "route" tag to logger middleware ( #2162 )
2022-12-04 19:38:45 +01:00
Martti T
8d4ac4c907
Additional configuration options for RequestLogger and Logger middleware ( #2341 )
...
* Add `middleware.RequestLoggerConfig.HandleError` configuration option to handle error within middleware with global error handler thus setting response status code decided by error handler and not derived from error itself.
* Add `middleware.LoggerConfig.CustomTagFunc` so Logger middleware can add custom text to logged row.
2022-11-30 15:47:23 +02:00
moznion
ddb66e1ba2
Add logger middleware template variables: ${time_unix_milli}
and ${time_unix_micro}
( #2206 )
...
This patch introduces two template variables `${time_unix_milli}` and
`${time_unix_micro}` into the logger middleware.
Currently, there is no way to interpolate that UNIX milli and micro
seconds timestamp in a log entry, and go 1.17 or later runtime supports
the utility functions `time#UnixMilli()` and `time#UnixMicro()`
so this patch adds them as well.
see also: https://github.com/golang/go/issues/44196
Signed-off-by: moznion <moznion@mail.moznion.net>
2022-07-05 07:57:39 +03:00
Martti T
1e7e67cddb
Added request logger middleware which helps to use custom logger library for logging requests ( #1980 )
...
Added request logger middleware which helps to use custom logger library for logging requests.
2021-09-14 20:57:47 +03:00
Shubhendra Singh Chauhan
6a666acd5c
improve code quality ( #1792 )
...
* Merge variable declaration with assignment
* Fix unnecessary typecasting on `bytes.Buffer`
* Remove unnecessary wrapping of function call
2021-02-26 12:04:34 +02:00
nattawitc
8cfaf50b8f
fix #1260 change middleware.Logger's default output ( #1336 )
...
* fix TestLoggerIPAddress reverse assertion
* change middleware.Logger default output
* remove nil field declaration
2019-07-17 21:34:31 -07:00
Alex Ungur
6d9e043284
Introduced Go module support as v4, removed obsolete CloseNotifier() mechanism
...
This reintroduces support for Go modules, as v4.
CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http
It was already NOT working (not sending signals) as of 1.11 the functionality was gone, we merely
deleted the functions that exposed it. If anyone still relies on it they should migrate to using
`c.Request().Context().Done()` instead.
Closes #1268 , #1255
2019-01-30 16:11:42 +02:00
Emir Ribić
c8fd197fa8
Replace http constants with stdlib ones, i.e.: http.MethodGet instead of echo.GET ( #1205 )
2018-10-14 20:46:58 +05:30
Kesus Kim
09dcba1d39
rename proto to protocol
2018-07-10 23:06:17 -07:00
Kesus Kim
2a5460328f
add test case for logger middleware
2018-07-10 23:06:17 -07:00
Evgeniy Kulikov
f49d166e6f
[FIX] Cleanup code ( #1061 )
...
Code cleanup
2018-02-21 10:44:17 -08:00
Airking05
181e11a330
[Add] custom time stamp format #1046 ( #1066 )
...
* [Add] custom time stamp format
* [Update] property name & default value & comment about custom logger
2018-02-19 08:05:09 -08:00
Vishal Rana
cb9255e775
Using httptest
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-05-13 15:44:27 -07:00
aruhi
1827916e76
Add cookie tag for logger ( #921 )
...
Thanks for your contribution 🎉
2017-05-08 08:10:11 -07:00
Vishal Rana
4b4a09fd31
Using random.String() for generating id
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-03-06 13:39:36 -08:00
Yusuke Komatsu
d3d0ee6527
add id (Request ID) in logger format.
2017-03-06 13:39:36 -08:00
Vishal Rana
29fd5831ff
Fixed test
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-22 15:57:12 -08:00
Vishal Rana
f56450d8ce
Fixed #821
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-12 09:09:51 -08:00
Vishal Rana
ce6b1e20db
Logger middleware interface ( #820 )
...
* Modified logger format
Signed-off-by: Vishal Rana <vr@labstack.com>
* Logger middleware via struct
Signed-off-by: Vishal Rana <vr@labstack.com>
* Fixed time format
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-11 20:07:51 -08:00
Antonio Pagano
4f1aef1469
Allows LoggerConfig to add new header, form, path and query tags ( #708 )
...
* [feature] implementing new log configuration tags for headers, form, query and path
* [refactor] merging all tests and removing path from the tags available for the logger
* [doc] updating middleware logger doc
* [tests] adding test cases for the other tags on the logger template
* [cleaning] moving h reference on tests to be a direct assignment given we dont need the reference to h anymore
2016-11-02 13:08:51 -07:00
Vishal Rana
2aec0353f5
First commit to v3, #665
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-22 22:56:00 -07:00
Vishal Rana
be825e0229
Refactored variable names
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-24 10:22:15 -07:00
Vishal Rana
ce80fc8ea4
Fixed middleware test cases
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-16 16:02:22 -07:00
Vishal Rana
8b5772cf65
Proper header and MIME constants
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-06 07:29:47 -07:00
Vishal Rana
b5d6c05101
Fixed #441 , #294
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-02 14:24:51 -07:00
Vishal Rana
a66162a3d2
Logging middleware fixes
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-21 17:27:14 -07:00
Vishal Rana
830b4eff3f
Some work on logger middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-18 22:25:11 -07:00
Vishal Rana
569d72cd76
Fixed import cycle
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-06 16:43:47 -08:00
Vishal Rana
e1d789ecbb
Logger as not an interface
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-06 09:52:32 -08:00
Vishal Rana
65fcca2ce3
Middleware interface
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-07 23:02:37 -08:00
Vishal Rana
f27de9a804
Fixed logging
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-04 19:29:49 -08:00
Vishal Rana
f405794a7c
Now using sync.Pool
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-04 14:40:08 -08:00
Vishal Rana
688293b5ed
v2 is compiling now
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-01-28 23:46:11 -08:00
Vishal Rana
72459fe299
Step towards v2
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-03 17:23:53 -08:00
Vishal Rana
9650c39055
Bumped to v1.3
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-01 15:06:18 -08:00
Vishal Rana
4f996419e1
Fixed #255
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-11-20 19:39:35 -08:00
Vishal Rana
143f563734
Moved code around
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-10-21 15:11:01 -07:00
Mark Bates
b02e78b749
Fixed bug where IP address wasn't showing up in log files. Also added
...
some tests for the Logger middleware.
2015-10-21 16:39:51 -04:00
Ben Huson
799f01a87b
Adding IP Addresses in log entries
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-09-18 11:07:43 -07:00
Vishal Rana
b9eec15c01
More test coverage
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-30 15:20:36 -07:00
Vishal Rana
a9e49e2430
Total coverage for middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-30 10:54:55 -07:00
Vishal Rana
bf85c56b08
Encapsulated fields and exposed public functions.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-22 04:40:01 -07:00
Vishal Rana
13ac746093
Refactored Echo.HandlerFunc, added WebSocket support.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-20 14:38:51 -07:00
Vishal Rana
1ee3bc23e3
Added gzip middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-15 12:29:14 -07:00