import Foundation enum Debug { static let isEnabled: Bool = { if let v = ProcessInfo.processInfo.environment["PROLESTATUS_DEBUG"] { return v == "1" || v.lowercased() == "true" || v.lowercased() == "yes" } return false }() static func log(_ message: @autoclosure () -> String) { guard isEnabled else { return } let ts = ISO8601DateFormatter().string(from: Date()) FileHandle.standardOutput.write(("[ProleStatus] " + ts + " " + message() + "\n").data(using: .utf8)!) } } @inline(__always) func dlog(_ message: @autoclosure () -> String) { Debug.log(message()) }