21 lines
708 B
Swift
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
|
|
}
|