Summary: - Sources: Protocols, Services, Utilities - Docs: README - Added symbols: struct UserProfile, extension StorageKeys, struct ProfileKey, typealias Value, extension StorageKey, func retrieve (+1 more) - Removed symbols: func retrieve, func delete Stats: - 4 files changed, 108 insertions(+), 36 deletions(-)
35 lines
830 B
Swift
35 lines
830 B
Swift
import Foundation
|
||
|
||
/// Internal logging utility for the LocalData package.
|
||
enum Logger {
|
||
static var isLoggingEnabled = true
|
||
|
||
static func debug(_ message: String) {
|
||
#if DEBUG
|
||
if isLoggingEnabled {
|
||
print(" {LOCAL_DATA} ℹ️ \(message)")
|
||
}
|
||
#endif
|
||
}
|
||
|
||
static func info(_ message: String) {
|
||
#if DEBUG
|
||
if isLoggingEnabled {
|
||
print(" {LOCAL_DATA} 📢 \(message)")
|
||
}
|
||
#endif
|
||
}
|
||
|
||
static func error(_ message: String, error: Error? = nil) {
|
||
#if DEBUG
|
||
var logMessage = " {LOCAL_DATA} ❌ \(message)"
|
||
if let error = error {
|
||
logMessage += " | Error: \(error.localizedDescription)"
|
||
}
|
||
if isLoggingEnabled {
|
||
print(logMessage)
|
||
}
|
||
#endif
|
||
}
|
||
}
|