sternenseemann / spacecookie

gopher library & server written in Haskell
https://sternenseemann.github.io/spacecookie/
GNU General Public License v3.0
47 stars 5 forks source link

feat(library): make library user implement logging #29

Closed sternenseemann closed 3 years ago

sternenseemann commented 3 years ago

'GopherLogConfig' has now been replaced with a 'GopherLogHandler' which may optionally be provided. This handler is simply an IO action which has the responsibility to log 'GopherLogStr's somewhere the user likes with formatting the user desires.

'LogMessage' has been replaced by a string type again, this time a custom one: 'GopherLogStr' is a wrapper type around a 'Seq' which contains 'Builder's. These builders can be marked as sensitive. Via the 'FromGopherLogStr' type class 'GopherLogStr's can be rendered to the commonly used string types. If a chunk has been marked as sensitive via 'markSensitive' it can be replaced with "[redacted]" by calling hideSensitive. Sensitive chunks are usually IP addresses of connecting clients.

The server has been adjusted to use this new API. As an additional benefit we don't allocate a 'TimedFastLogger' anymore if we don't need it (i. e. logHideTime = True).

Resolves #24.

To do: