Log
struct Log
Thin wrapper around os.Logger that automatically captures file, function and line numbers.
Usage:
Log.cache.debug("my debug message")
// prints: MapCache.swift[42]::myMethod -- my debug message
Log.cache.error("tile not found with error \(error)")
// prints: MapCache.swift[99]::fetchTile -- tile not found with error ...
Log.diskcache.info("cache size calculated")
// prints: DiskCache.swift[55]::calculateDiskSize -- cache size calculated
Log.downloader.trace("network request started")
// prints: RegionDownloader.swift[77]::start -- network request started
-
Declaration
Swift
let logger: Logger -
Declaration
Swift
init(subsystem: String, category: String) -
Declaration
Swift
private static func baseName(_ function: String) -> String -
Log at
.debuglevel. Extremely verbose, not persisted, development only.Declaration
Swift
func trace(_ message: String, file: String = #file, function: String = #function, line: Int = #line) -
Log at
.debuglevel. Not persisted, useful during development.Declaration
Swift
func debug(_ message: String, file: String = #file, function: String = #function, line: Int = #line) -
Log at
.infolevel. Persisted in the log archive, useful for important state changes.Declaration
Swift
func info(_ message: String, file: String = #file, function: String = #function, line: Int = #line) -
Log at
.defaultlevel. Noteworthy events that are not errors.Declaration
Swift
func notice(_ message: String, file: String = #file, function: String = #function, line: Int = #line) -
Log at
.errorlevel. Recoverable errors that should be investigated.Declaration
Swift
func error(_ message: String, file: String = #file, function: String = #function, line: Int = #line) -
Log at
.faultlevel. Critical failures that may impact app stability.Declaration
Swift
func fault(_ message: String, file: String = #file, function: String = #function, line: Int = #line) -
Cache operations (tile fetching, URL building, ETag handling)
Declaration
Swift
static let cache: Log -
Disk storage operations (read/write/eviction)
Declaration
Swift
static let diskcache: Log -
Region downloader operations
Declaration
Swift
static let downloader: Log
View on GitHub