2026-08-27 23:26:14 +01:00

21 lines
708 B
Swift

import Foundation
/// App-wide replacement for `print()`.
/// Drop-in: same call site syntax — `log("Something happened", value, separator: " | ")`
/// In Release builds all output is suppressed automatically.
func fluxlog(
_ items: Any...,
separator: String = " ",
terminator: String = "\n",
file: String = #file,
function: String = #function,
line: Int = #line
) {
#if DEBUG
let fileName = (file as NSString).lastPathComponent.replacingOccurrences(of: ".swift", with: "")
let prefix = "[\(fileName):\(line) \(function)]"
let message = items.map { "\($0)" }.joined(separator: separator)
Swift.print("\(prefix) \(message)", terminator: terminator)
#endif
}