k0001 / di

Easy and powerful typeful logging without monad towers, in Haskell.
26 stars 5 forks source link

df1: Write formal spec #21

Open k0001 opened 6 years ago

k0001 commented 6 years ago

As of df1 0.2 there is a draft BNF specification in the docs. This hasn't been verified, however.

juhp commented 9 months ago

I am curious why Level comes after Path? Certainly not easier for humans to read I think.

Anyway just a random thought/question - I haven't even tried the libraries :-)

k0001 commented 9 months ago

Hello @juhp! How are you? Good question. There are two reasons for this.

  1. The level words (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) are not of the same length. This means that when rendered as a prefix, they will cause the following /foo bar=baz /qux path to be misaligned vertically across multiple lines. I find this to be more harmful to quick visual pattern recognition than putting the level later. Consider how this example would change if the paths were misaligned vertically:

Image

  1. The level words are not a well-formed path part (those need to start with / or have a = in it), so if we put it right after the path, it can serve as a separator between the path and the message, too. Otherwise, we'd need some kind of separator to tell the path apart from the message.

I'm happy to entertain different ideas if you have them. I haven't been able to come up with a better solution than the current one. Colors help a lot.