enforce that logging system can only be bootstrapped once (#32)

motivation: safer logging system

changes: do a precondition check to verify logging syste is only initialized/bootstrapped once per process
This commit is contained in:
tomer doron authored and Johannes Weiss committed 2019-02-22 18:13:52 +00:00
1 parent 045ba36718
commit c7583429a6
11 files changed
+47 -26

No files matched your search

@@ -2,7 +2,6 @@
// THIS IS NOT PART OF THE PITCH, JUST AN EXAMPLE HOW A LOGGER USAGE LOOKS LIKE
//
import ExampleImplementation
import Foundation
import Logging
@@ -25,8 +24,6 @@ var logger: Logger {
// this is a contrived example of a system that shares one global logger
enum GlobalLoggerBasedSystem {
static func main() {
// boostrap with our sample implementation
LoggingSystem.bootstrap(SimpleLogHandler.init)
// run the example
for i in 1 ... 2 {
print("---------------------------- processing request #\(i) ----------------------------")