 }
 
 private struct Log: TextOutputStream {
-    static var log = Log()
+    static var shared = Log()
     #if DEBUG
     var file = "debug_log.txt"
     #else

    private init() {}
    /// Appends the given string to the stream.
    mutating func write(_ string: String) {
        #if DEBUG
        Swift.print(string)
        #endif
        let paths = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask)
        let documentDirectoryPath = paths.first!
        let log = documentDirectoryPath.appendingPathComponent(self.file)

    file: String = #file, line: Int = #line, function: String = #function,
    logLevel: LogLevel = .info) {
    let fileName = URL(fileURLWithPath: file).deletingPathExtension().lastPathComponent
    let log = { (items: Any...) in
        print(items, to: &Log.shared)
    }
    log(logLevel.symbol, logLevel.rawValue, CFAbsoluteTimeGetCurrent(), "⇨",
        fileName, line, function)
    items.forEach { log($0) }
    switch logLevel {
    case .debug, .info:
        break
    case .warning:
        log(Thread.current)
    case .error, .exception:
        log(Thread.current)
        Thread.callStackSymbols.forEach { log($0) }
    }
}

