Skip to content

Instantly share code, notes, and snippets.

@skreutzberger
Last active July 4, 2016 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skreutzberger/7cd77377de4ca33d3fe98ae3a3982293 to your computer and use it in GitHub Desktop.
Save skreutzberger/7cd77377de4ca33d3fe98ae3a3982293 to your computer and use it in GitHub Desktop.
Log to Document Directory
// 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