Commit graph

62 commits

Author SHA1 Message Date
4eb5d68fbf
Fix for the fix
I didn't actually write the found ip to the logging stack (or whatever
zerolog uses). This is now fixed
2025-05-12 15:35:45 +02:00
d7ed5b1eae
fix(webutils): Bad Ip logging
Fix the logging middleware only logging the last proxy's ip instead of
the ip of the actual request
2025-05-12 15:08:53 +02:00
506834c881
Extend logging middleware with more config options 2025-05-04 19:28:03 +02:00
4b8a62ba12
Add some more documentation and links to godoc# 2025-04-28 08:49:13 +02:00
fa857615dd
Maybe fix cov img 2025-04-24 16:24:16 +02:00
8156b5b8eb
Update readme 2025-04-24 16:23:30 +02:00
92e881b3e4
Add coverage badge 2025-04-24 16:01:37 +02:00
ccf98c2f6e
Shit ton of tests 2025-04-24 15:59:15 +02:00
99b00887a8
Apply some guy's law about logic operation reordering 2025-04-24 15:58:32 +02:00
695b48ae91
More error returns added 2025-04-24 15:58:21 +02:00
2b737d056c
Add err returns 2025-04-24 15:58:06 +02:00
4013622afc
Remove logrotate, lumberjack is better 2025-04-24 15:57:49 +02:00
8bb1797894
Remove multiplexer, since wrong implemented 2025-04-24 15:57:30 +02:00
be9ed2adef
Remove mutex, since no usages 2025-04-24 15:57:14 +02:00
09de0a19e1
Change queues and stacks
- Make chain element private
- Remove JSON Marshaller from stack and queue
- Remove access to top chain element
2025-04-24 15:52:43 +02:00
9870d87d41
Add sliceutils.ContainsFunc 2025-04-11 12:38:41 +02:00
15887d9d2e
Add builder for Logging middleware
Builder offers option to add extra fields to log messages
2025-04-11 10:44:50 +02:00
e8aa16622b
Add generic math abs 2025-04-10 14:36:51 +02:00
4612ee993e
BREAKING CHANGE: Rename http module to webutils 2025-04-09 13:57:01 +02:00
9b6664399f
Fix header write order
Headers need to be written before status code
2025-04-09 13:11:12 +02:00
2bc73d2262
Add ProblemDetails support and deprecate HttpErr 2025-04-09 09:51:36 +02:00
0a22727d46
BREAKING CHANGE: Update ConfigureLogging
Now takes a writer as additional output next to stderr
to write logs to
2025-04-08 17:09:50 +02:00
0eafc6806b
fix(logrotate): Now creates dir needed
If the directory containing the target log file doesn't exist, try and
create the directory first
2025-03-24 17:28:38 +01:00
afcc54c831
BREAKING CHANGE: Remodelled logging setup
- other.ConfigureLoggingFromCliArgs has been renamed to
  other.ConfigureLogging
- The -logfile cli argument has been removed and replaced with an
  argument to other.ConfigureLogging. This argument takes a pointer to a
  string or nil. If it's a valid pointer, it's used just like the
  -logfile cli flag before
- The logfile, if requested via the previously mentioned parameter, can
  now be rotated by calling the returned function. If no logfile is
  specified, the returned function does nothing
2025-03-24 08:39:04 +01:00
eedc7b9dc1
Add log rotator 2025-03-24 08:23:36 +01:00
59539c7e97
Add error formatter and docs 2025-03-04 13:57:51 +01:00
18bf623114
Restructure all http related files
Moving all http related functions and helpers into a new http submodule
2025-03-04 13:56:57 +01:00
0a0c185c06 Swap order of logging setup
Fixes unformatted logging output at beginning
2025-02-03 14:26:56 +01:00
c6860b4a3a Fix wrong var name 2024-12-30 14:44:11 +01:00
40d31bc53f Add zerolog boilerplate helpers
Includes 3 cli vars ("loglevel", "logjson", "logfile")
One public function to configure the global zerolog handler based on
those arguments
2024-12-30 14:25:25 +01:00
77e09295be Fix maputils 2024-12-02 08:42:42 +01:00
f387fcb1b9 Fix module name 2024-12-01 10:41:26 +01:00
14c58baa95 Merge branch 'main' of gitlab.com:mstarongitlab/goutils 2024-12-01 10:32:26 +01:00
8d8fe03598 Add map compactor 2024-12-01 10:31:46 +01:00
7722a73ba2 Add compact slice function 2024-12-01 10:29:28 +01:00
ea4a111af6
Merge branch 'main' of gitlab.com:beckersam/goutils 2024-11-26 17:32:37 +01:00
9d803a94ee
Add middlewares
- Builder for chaining multiple middlewares on top of a base handler
- Middleware for adding a map of values to the request context
- Middleware for adding zerolog logging to the request
2024-11-26 17:30:05 +01:00
9a7f26995f Update HttpErr
It now no longer has to go through json encoding and uses a hardcoded
string instead. Also clears the one location where an error could occur
2024-10-13 13:27:16 +02:00
bdbcf826eb
Merge branch 'main' of gitlab.com:beckersam/goutils 2024-09-28 12:39:53 +02:00
bd60c842e9
Add basic http error formatter 2024-09-28 12:37:06 +02:00
36eb60f298 Add LICENSE 2024-09-09 15:24:19 +00:00
c4ad5bc3c2 Delete LICENSE for changing it to MIT 2024-09-09 15:23:39 +00:00
f6878107d8
sync for backup 2024-08-22 19:56:37 +02:00
b3db20785b Rename MapMap and new map func
Renamed MapMap to MapSameKeys to increase clarity for usage
Added func MapNewKeys to allow making a map with new keys too
2024-07-30 17:07:50 +02:00
66a118e6ef Fix maputils 2024-07-30 16:58:10 +02:00
83e935df8a Add func to get the pointer to some value 2024-07-07 16:00:08 +02:00
mStar aka a person
70f6d19476 Add wrapper for embed.FS to "fix" it including the full filepath for included files 2024-02-21 14:12:50 +01:00
mStar aka a person
a969a91746 Add multiplexer 2024-02-11 11:35:59 +01:00
mStar aka a person
7f9be06e1b Fix go.mod for new gitlab username 2024-01-17 09:48:27 +01:00
mStar aka a person
ae2da5efa5 Moved stuff, added Contains to sliceutils 2024-01-17 09:47:33 +01:00