Last active
July 4, 2016 07:34
-
-
Save skreutzberger/7cd77377de4ca33d3fe98ae3a3982293 to your computer and use it in GitHub Desktop.
Log to Document Directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sends SwiftyBeaver logs to a file in your app’s document directory | |
// instead of the default caches directory | |
// learn more about SwiftyBeaver at https://github.com/SwiftyBeaver/SwiftyBeaver | |
let fm = NSFileManager.defaultManager() | |
if let docsURL = fm.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first { | |
let file = FileDestination() | |
file.logFileURL = docsURL.URLByAppendingPathComponent("my.log") | |
log.addDestination(file) | |
log.info("writing logs to \(file.logFileURL)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment