Commit Graph

12 Commits

Author SHA1 Message Date
Matt Holt
5d97522d18
v2: 'log' directive for Caddyfile, and debug mode (#3052)
* httpcaddyfile: Begin implementing log directive, and debug mode

For now, debug mode just sets the log level for all logs to DEBUG
(unless a level is specified explicitly).

* httpcaddyfile: Finish 'log' directive

Also rename StringEncoder -> SingleFieldEncoder

* Fix minor bug in replacer (when vals are empty)
2020-02-25 22:00:33 -07:00
Matthew Holt
95d944613b
Export Replacer and use concrete type instead of interface
The interface was only making things difficult; a concrete pointer is
probably best.
2019-12-29 13:12:52 -07:00
Matthew Holt
fe516575db
core: Add ReplaceFunc method to Replacer to allow dynamic replacements 2019-12-17 16:29:09 -07:00
Matthew Holt
ad90b273db
core: Add tests to Replacer; fix panic (fixes #2852) 2019-11-11 19:29:31 -07:00
Matt Holt
b00dfd3965
v2: Logging! (#2831)
* logging: Initial implementation

* logging: More encoder formats, better defaults

* logging: Fix repetition bug with FilterEncoder; add more presets

* logging: DiscardWriter; delete or no-op logs that discard their output

* logging: Add http.handlers.log module; enhance Replacer methods

The Replacer interface has new methods to customize how to handle empty
or unrecognized placeholders. Closes #2815.

* logging: Overhaul HTTP logging, fix bugs, improve filtering, etc.

* logging: General cleanup, begin transitioning to using new loggers

* Fixes after merge conflict
2019-10-28 14:39:37 -06:00
Matthew Holt
9c0bf311f9
Miscellaneous cleanups / comments 2019-10-10 15:38:30 -06:00
Johannes Hörmann
95a447de9c Tests for replacer (#2675)
* Tests for Replacer: Replacer.Set and Replacer.Delete

* update replacer test to new implementation

* fix replacer: counted position wrong if placeholder was found

* fix replacer: found placeholder again, if it was a non-existing one

* test with spaces between the placeholders as this could have a different behaviour

* Tests for Replacer.Map

* Tests for Replacer.Set: check also for something like {l{test1}
This should be replaced as {lTEST1REPLACEMENT

* fix replacer: fix multiple occurrence of phOpen sign

* Tests for Replacer: rewrite Set and ReplaceAll tests to use implementation not interface

* Tests for Replacer: rewrite Delete test to use implementation not interface

* Tests for Replacer: rewrite Map tests to use implementation not interface

* Tests for Replacer: add test for NewReplacer

* Tests for Replacer: add test for default replacements

* Tests for Replacer: fixed and refactored tests

* Tests for Replacer: moved default replacement tests to New-test
as new should return a replace with provider which defines global replacements
2019-07-21 09:57:34 -06:00
Matt Holt
b44a22a9d4
Performance improvements to Replacer implementation (placeholders) (#2674)
Closes #2673
2019-07-16 12:27:11 -06:00
Matthew Holt
6bcba91fbe
Lowercase env var names in replacer 2019-07-03 15:42:21 -06:00
Matthew Holt
3177ee8010 Add license 2019-06-30 16:07:58 -06:00
Matthew Holt
5137859e47 Rename caddy2 -> caddy
Removes the version from the package name
2019-06-14 11:58:28 -06:00
Matthew Holt
fec7fa8bfd Implement most of static file server; refactor and improve Replacer 2019-05-20 10:59:20 -06:00