Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. //___FILEHEADER___
  2.  
  3. import Foundation
  4.  
  5. // To use this as a template, do the following:
  6. // 1. Create the 'Custom' directory -> mkdir -p ~/Library/Developer/Xcode/Templates/File\ Templates/Custom
  7. // 2. Open Finder, CMD + G into this directory /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates
  8. // 3. Open 'Source' directory and copy the Swift File.xctemplate
  9. // 4. Paste the Swift File.xctemplate into to the 'Custom' directory from step 1
  10. // 5. Rename the Swift File.xctemplate in the 'Custom' directory to the desired name for the template
  11. // 6. Replace the '___FILEBASENAME___.swift' file in template directory with this file
  12. // 7. Alternatively, edit the '___FILEBASENAME___.swift' to suit your needs
  13.  
  14. // This helper class is helpful for when the debugging output produced by the programmer is buried by the debugging output from the system.
  15. // To see programmer debugging output only, do the following:
  16. // 1. Use this Logger's log functions
  17. // 2. Type [the name of your project] in the console pane (debug area) bottom-right filter.
  18.  
  19. class Logger {
  20.  
  21. private init () {}
  22.  
  23. private static let project : String = "___PROJECTNAME___"
  24.  
  25. static func log(_ string: String, label: String = "INFO"){
  26. DispatchQueue.main.async {
  27. print("[\(Logger.project)][\(label)]: \(string)")
  28. }
  29. }
  30.  
  31. static func info(_ string: String) {
  32. Logger.log(string)
  33. }
  34.  
  35. static func warning(_ string: String) {
  36. Logger.log(string, label: "WARNING")
  37. }
  38.  
  39. static func error(_ string: String) {
  40. Logger.log(string, label: "ERROR")
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement