Rather than spawning a new goroutine for each message,
run each log system in a dedicated goroutine.
Ensure that logging is still asynchronous by using a per-system buffer
(currently 500 messages). If it overflows all logging will hang,
but that's better than spawning indefinitely many goroutines.
Messages are formatted by generic part, so the log system doesn't need
to provide formatting. This fixes the test from the previous commit.
As a small bonus, log systems now have access to the level of
the message. This could be used to provide colored logging in the
future.
- introduce quit, drained, shutdown channels
- mainLoop falls through reading message channel to drained state, and waits is blocked in default branch until any message is sent
- Flush() waits for <-drained
- Stop() pushes quit and nodges mainloop out of blocking drained state
- package-global mutex
- Reset()
- clear tests
- packages use tagged logger sending log messages to shared (process-wide) logging engine
- log writers (interface ethlog.LogSystem) can be added to the logging engine by wrappers/guis/clients
- shared logging engine dispatching to multiple log systems
- log level can be set separately per log system
- async logging thread: logging IO does not block main thread
- log messages are synchronously stringified to avoid incorrectly logging of changed states
- README.md
- loggers_test