brendanhay/amazonka — pull request #20 by brendanhay (2014-11-27 14:33:51+00:00)
Title: Improve flexibility and performance of logging

The logging available from `amazonka-core` is currently for debugging purposes, and primarily exists as a mechanism for the author (me) to track down erroneous requests and signing issues.

I'd like to improve upon this incrementally - towards something that is more general, but flexible, without resorting to including a full logging library as a dependency.

The first step is to avoid conversion of types via `Show` and `ToText` and instead use specialised `ToBuilder` instances to create a `Data.ByteString.Builder` which can be written to a `Handle` with a minimum amount of allocation or buffer flushes.

This changes the previous `Text -> IO ()` + `Info` + `None` logging constructors to: `
type Logger = LogLevel -> Builder -> IO ()`, you can see the primitive [`newLogger`](https://github.com/brendanhay/amazonka/blob/008213119027a82a5dedc76ad6e686627480f53b/amazonka/src/Network/AWS/Internal/Log.hs#L32) for an example implementation.

Additionally the logging types/functions have been moved out of `amazonka-core` and into `amazonka` proper.