Skip to content

Commit 7bb028a

Browse files
committed
[readme] documenting how the logging module works
1 parent 8d54426 commit 7bb028a

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,27 @@ This module also contains a module-per-type with lenses for that type. The
141141
lenses follow the same format as [Aether](https://github.com/xyncro/aether)
142142
recommends.
143143

144+
### `logibit.hawk.Logging`
145+
146+
Types:
147+
148+
- `LogLevel` - the level of the LogLine.
149+
- `LogLine` - this is the data structure of the logging module, this is where
150+
you feed your data.
151+
- `Logger interface` - the main interface that we can log to/into.
152+
- `Logger module` - a module that contains functions equiv. to the instance
153+
methods of the logger interface.
154+
- `NoopLogger : Logger` - the default logger, you have to replace it yourself
155+
156+
It's good to know that you have to construct your LogLine yourself. That
157+
LogLines with Verbose or Debug levels should be sent to the `debug` or `verbose`
158+
functions/methods of the module/interface Logger, which in turn takes functions,
159+
which are evaluated if it's the case that the logging infrastructure is indeed
160+
logging at that level.
161+
162+
This means that logging at that level, and computing the log lines, needs only
163+
be done if we can really do something with them.
164+
144165
### `logibit.hawk.Choice`
145166

146167
This module adds some functions for composing Choice-s:
@@ -184,13 +205,5 @@ There are some modules that are currently internal as to avoid conflicting with
184205
existing code. If these are made 'more coherent' or else moved to external
185206
libraries, they can be placed on their own and be made public. The modules like this are `Random`, `Prelude`, `Parse`.
186207

187-
There's a cut at a logging abstraction - however, with the types used in this library,
188-
it's not that much need for logging - the types include all the needed info and
189-
adding logging in the wrong place can open the code up to differential attacks.
190-
191-
When the Logging abstraction is being used, it would be prudent to open up the
192-
required configuration point and possible use the interface in the
193-
`Settings<'a>` type. Until then, the module is internal.
194-
195208
[ng-h]: https://www.nuget.org/packages/Hawk/
196209
[ng-hs]: https://www.nuget.org/packages/Hawk.Suave/

src/logibit.hawk.tests/Server.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ let server =
7373

7474
let settings =
7575
{ clock = clock
76+
logger = Logging.NoopLogger
7677
allowed_clock_skew = Duration.FromMilliseconds 8000L
7778
local_clock_offset = Duration.Zero
7879
nonce_validator = Settings.nonce_validator_noop

0 commit comments

Comments
 (0)