LocalData/Sources/LocalData/Utilities/Logger.swift
Matt Bruce b42bb31723 Update Protocols, Services, Utilities + docs
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(-)
2026-01-18 14:53:28 -06:00

35 lines
830 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
/// 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
}
}