Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

swift-log について

679 views

Published on

apple の swift-log について雑に調べました

Published in: Technology
  • Be the first to comment

  • Be the first to like this

swift-log について

  1. 1. swift-log (@mike_neck)
  2. 2. • • twitter: @mike_neck • GitHub: mike-neck • L is B Java • Swift • Swift
  3. 3. direct
  4. 4. • •swift-log •swift-log x Willow
  5. 5. • • •
  6. 6. • • • / (struct)/ / • •
  7. 7. Swift •NSLog/print •SwiftyBeaver/SwiftyBeaver •Nike/Willow •IBM-Swift/LoggerAPI + HeliumLogger
  8. 8. NSLog/print (NSLog) ☓ ☓ ☓ ( ) SwiftyBeaver ☓ Willow ☓ HeliumLogger LoggingAPI ☓
  9. 9. swift-log
  10. 10. What’s swift-log • swift-log apple API • API • • CocoaPods/Carthage support issue •
  11. 11. Logging API? • • • • Logging API
  12. 12. Logging API? • • •
  13. 13. Logging API? • Logging API • Logging API protocol Adapter
  14. 14. swift-log x Willow
  15. 15. sift-log
  16. 16. demo 1 swift-log swift-log
  17. 17. Logger var logger = Logger(label: "com.example.MyApp") logger.info("Now it works!") logger.error("Error help me!") logger.logLevel = .info logger.info("Now it works!") // logger.debug("This is debug!") //
  18. 18. demo 2 swift-log x Willow swift-log
  19. 19. LogHandler struct WillowLogHandler: LogHandler { var metadata: Logger.Metadata var logLevel: Logger.Level subscript(metadataKey _: String) -> Logger.Metadata.Value? func log( // level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, file: String, function: String, line: UInt) }
  20. 20. LoggingSystem LoggingSystem.bootstrap { label in WillowLogHandler() } // LoggingSystem.bootstrap LoggerHandler // WillowHandler LogHandler var logger = Logger(label: "com.example.MyApp") logger.info("Now it works!") logger.error("Error help me!")
  21. 21. • swift-log Logging API • • LogHandler • swift-log … •

×