You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
580 B

2 years ago
  1. //
  2. // Copyright © 2019 Swinject Contributors. All rights reserved.
  3. //
  4. public typealias LoggingFunctionType = (String) -> Void
  5. public extension Container {
  6. /// Function to be used for logging debugging data.
  7. /// Default implementation writes to standard output.
  8. static var loggingFunction: LoggingFunctionType? {
  9. get { return _loggingFunction }
  10. set { _loggingFunction = newValue }
  11. }
  12. internal static func log(_ message: String) {
  13. _loggingFunction?(message)
  14. }
  15. }
  16. private var _loggingFunction: LoggingFunctionType? = { print($0) }