prole/prole-tools-app/Sources/Debug.swift
chrisfu 0e01595de0 refactor: switch to environment wrapper; standardize env.sh usage and improve $PROLE_HOME management
- Replace direct script invocation with `$PROLE_HOME/env.sh` wrapper for consistent environment setup across all components.
- Update runtime processes to dynamically resolve `$PROLE_HOME` or fallback to `$HOME/.prole`.
- Deprecate `init-port-forwards.sh` script bundling; remove from LaunchAgentManager and build system.
- Overhaul `env.sh` generation to include execution capability, customizable paths, and improved error handling.
- Standardize app name and paths to "Prole Tools" across all files and UI elements.
- Adjust build output to align with new structure, including executable naming and resource packaging.
2025-12-15 22:00:32 -08:00

22 lines
643 B
Swift

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())
}