SecureStorageSample/localPackages/SharedPackage/Sources/SharedKit/Utilities/Logger.swift
2026-01-19 09:00:14 -06:00

27 lines
693 B
Swift
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Foundation
/// Public logging utility for the SecureStorage workspace.
public enum Logger {
public static var isLoggingEnabled = true
public static func debug(_ message: String) {
#if DEBUG
if isLoggingEnabled {
print(" {SECURE_STORAGE} \(message)")
}
#endif
}
public static func error(_ message: String, error: Error? = nil) {
#if DEBUG
var logMessage = " {SECURE_STORAGE} ❌ \(message)"
if let error = error {
logMessage += " | Error: \(error.localizedDescription)"
}
if isLoggingEnabled {
print(logMessage)
}
#endif
}
}