serokell / log-warper

Logging library to provide more convenient, extremely configurable but simple monadic interface with pretty output
MIT License
19 stars 11 forks source link

Find better solution for monadic stack #96

Closed chshersh closed 6 years ago

chshersh commented 6 years ago

After several refactorings monadic stack for logging will be scary:

  1. ReaderT for LoggerName
  2. ReaderT for LogInternalState for IO-logger.
  3. ReaderT for LoggerConfig.

Having three nested ReaderT for representing just single effect looks ugly to me... Also, it's worse for performance rather than having single ReaderT. Though, abstraction through effects is necessary to support pure logging. Having two separate type classes probably not necessary:

  1. HasLoggerName for taking logger name from context
  2. CanLog for dispatching logger names.

Proposal

  1. Merge HasLoggerName and CanLog into single type class.
  2. Have two ReaderT-like data types: for pure and non-pure logging.
  3. Abstract LoggerConfig in some way that it can be specified partially. Also it should store LoggerName for current logger as well.
chshersh commented 6 years ago

Done in 2.0.