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
@@ -11,8 +10,6 @@ import Logging
// we also allow users to set metadata on the context object and reuse that as the metadata for logging
enum ContextBasedSystem {
static func main() {
// boostrap with our sample implementation
LoggingSystem.bootstrap(SimpleLogHandler.init)
// run the example
for i in 1 ... 2 {
print("---------------------------- processing request #\(i) ----------------------------")