         return "[\(map { $0.logDescription }.joined(separator: ", "))]"
     }
 }
+
+extension Reactive where Base == RxBluetoothKitLog {
+    /**
+     * This is continuous value, which emits before a log is printed to standard output.
+     *
+     * - it never fails
+     * - it delivers events on `MainScheduler.instance`
+     * - `share(scope: .whileConnected)` sharing strategy
+     */
+    var log: Observable<String> {
+        return RxBluetoothKitLog.subject.asObserver()
+            .observeOn(MainScheduler.instance)
+            .catchErrorJustReturn("")
+            .share(scope: .whileConnected)
+    }
+}


import Foundation
import CoreBluetooth

/**
 RxBluetoothKit specific logging class which gives access to its settings.
 */
public class RxBluetoothKitLog {

    fileprivate static var currentLogLevel: LogLevel = .none

    private init() {
    }


    fileprivate static func log(with logLevel: LogLevel, message: @autoclosure () -> String) {
        if currentLogLevel <= logLevel {
            let string = "\(tag(with: logLevel)) \(message())"
            subject.onNext(string)
            print(string)
        }
    }

