Commit Graph

26 Commits

Author SHA1 Message Date
Felix Lange fd9b03a431 ethlog: fix concurrency
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.
2014-10-17 17:23:29 +02:00
Felix Lange c090a77f1c ethlog: simplify LogSystem interface
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.
2014-10-17 17:23:29 +02:00
Felix Lange 50f5ba5b0c ethlog: add test for '%' in log message
This test fails because the log message is formatted twice.
2014-10-17 17:23:29 +02:00
Felix Lange 0165c18330 ethlog: use Godoc for code examples in documentation
This ensures that examples will actually compile.
2014-10-17 17:20:44 +02:00
Felix Lange e0f93c74c5 ethlog: add Godoc documentation, remove README 2014-10-17 17:20:44 +02:00
Felix Lange a6265cb49a ethlog: verify that Flush is blocking in TestLoggerFlush 2014-10-17 17:20:44 +02:00
Felix Lange 793baf060a ethlog: don't buffer output in TestConcurrentAddSystem 2014-10-17 17:20:44 +02:00
Felix Lange ec132749aa ethlog: improve TestLogSystem
It's now safe for concurrent access.
Output checking looks better.
2014-10-17 17:20:44 +02:00
Felix Lange 45d1052229 ethlog: fix StdLogSystem data race on level 2014-10-17 17:20:44 +02:00
Felix Lange d5a7ba1626 ethlog: add test that adds log systems concurrently 2014-10-17 17:20:44 +02:00
Felix Lange 3b1296077b ethlog: Reset before each test 2014-10-17 17:20:43 +02:00
Felix Lange dac128a029 ethlog: fix test compilation error 2014-10-17 17:20:43 +02:00
Felix Lange 4e95cecfb9 ethlog: improve dispatch concurrency
This also fixes a deadlock in the tests.
2014-10-17 17:20:43 +02:00
zelig 1e4af85a38 merge upstream 2014-07-21 13:26:29 +01:00
obscuren 2762ec22d0 Fixed miner and logger 2014-07-18 13:50:15 +02:00
zelig d1c89727dc fix send overwritten by merge 2014-07-14 19:02:34 +01:00
zelig 3d5db7288f merge upstream 2014-07-14 18:50:06 +01:00
zelig 5c03adbded fix logger channel blocking 2014-07-14 18:37:01 +01:00
obscuren e4e704f480 Fix quit 2014-07-07 16:05:59 +02:00
Jeffrey Wilcke 6fe9b4ab5e Revert "ethreact - Feature/ethutil refactor" 2014-07-07 10:59:16 +02:00
zelig d4300c406c logger fix
- 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
2014-07-05 19:11:08 +01:00
obscuren 329887df99 Fixed crazy looping 2014-07-05 13:24:26 +02:00
zelig 853053a3b2 go fmt 2014-06-26 18:45:57 +01:00
zelig 6465e4c3fd update doc: list levels and show usage of named print methods 2014-06-25 16:38:42 +01:00
zelig e75f7ae330 implement DebugDetail loglevel and named print methods 2014-06-25 16:37:38 +01:00
zelig 8e9cc36979 refactor logging. Details:
- 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
2014-06-23 12:49:04 +01:00