Skip to content

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

Merged
sternenseemann merged 6 commits into
masterfrom
user-logging
Jan 6, 2021
Merged

sternenseemann merged 6 commits into
masterfrom
user-logging

Conversation

@sternenseemann

@sternenseemann sternenseemann commented Jan 6, 2021 •

Copy link
Copy Markdown
Owner

'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:

  • Document Network.Gopher.Log
  • Handle log level

@sternenseemann
sternenseemann force-pushed the user-logging branch 6 times, most recently from 16bc735 to 57d2901 Compare January 6, 2021 13:22
'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).
@sternenseemann
sternenseemann merged commit ff1dee5 into master Jan 6, 2021
@sternenseemann
sternenseemann deleted the user-logging branch January 6, 2021 14:17
@sternenseemann
sternenseemann restored the user-logging branch March 15, 2021 12:40
@sternenseemann
sternenseemann deleted the user-logging branch March 15, 2021 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow user logging

1 participant