diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eaf4bac..0584600a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log +* **Version 7.0.1**: *(2020/02/04)* - Updated for Xcode 11.3.1, adds in missing convenience methods for notice, alert, and emergency (thanks @hk05) * **Version 7.0.0**: *(2019/03/26)* - Updated for Xcode 10.2/Swift 5.0, adds additional log levels: notice, alert, and emergency * **Version 6.1.0**: *(2018/09/16)* - Fix for Xcode 10.0 warnings/Swift 4.2, other minor tweaks * **Version 6.0.4**: *(2018/06/11)* - Fix for Xcode 9.3 warnings/Swift 4.1 (thanks @ijaureguialzo), and other fixes diff --git a/DemoApps/iOSDemo/iOSDemo.xcodeproj/project.pbxproj b/DemoApps/iOSDemo/iOSDemo.xcodeproj/project.pbxproj index 3d73ba81..7ff7f3f5 100644 --- a/DemoApps/iOSDemo/iOSDemo.xcodeproj/project.pbxproj +++ b/DemoApps/iOSDemo/iOSDemo.xcodeproj/project.pbxproj @@ -712,7 +712,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -761,7 +761,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; diff --git a/DemoApps/iOSDemo/iOSDemo/Base.lproj/Main.storyboard b/DemoApps/iOSDemo/iOSDemo/Base.lproj/Main.storyboard index f753c427..2ea33668 100644 --- a/DemoApps/iOSDemo/iOSDemo/Base.lproj/Main.storyboard +++ b/DemoApps/iOSDemo/iOSDemo/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -22,7 +20,7 @@ - - + + @@ -40,7 +38,7 @@ + + - + - - + @@ -231,32 +294,47 @@ + + + - + + + + + + + + + - + + + - + + + @@ -264,26 +342,32 @@ + + - - + + + + + + - + diff --git a/DemoApps/iOSDemo/iOSDemo/ViewController.swift b/DemoApps/iOSDemo/iOSDemo/ViewController.swift index dbceebbc..4872bf19 100644 --- a/DemoApps/iOSDemo/iOSDemo/ViewController.swift +++ b/DemoApps/iOSDemo/iOSDemo/ViewController.swift @@ -49,6 +49,14 @@ class ViewController: UIViewController { } } + @IBAction func noticeButtonTouchUpInside(_ sender: AnyObject) { + log.notice("Notice button tapped") + log.notice { + // add expensive code required only for logging, then return an optional String + return "Executed notice code block" // or nil + } + } + @IBAction func warningButtonTouchUpInside(_ sender: AnyObject) { log.warning("Warning button tapped") log.warning { @@ -73,6 +81,22 @@ class ViewController: UIViewController { } } + @IBAction func alertButtonTouchUpInside(_ sender: AnyObject) { + log.alert("Alert button tapped") + log.alert { + // add expensive code required only for logging, then return an optional String + return "Executed alert code block" // or nil + } + } + + @IBAction func emergencyButtonTouchUpInside(_ sender: AnyObject) { + log.emergency("Emergency button tapped") + log.emergency { + // add expensive code required only for logging, then return an optional String + return "Executed emergency code block" // or nil + } + } + @IBAction func verboseSensitiveButtonTouchUpInside(_ sender: AnyObject) { // Can add multiple Dev/Tag objects together using the | operator log.verbose("Verbose (Sensitive) button tapped", userInfo: Dev.dave | Tag.sensitive) @@ -87,6 +111,10 @@ class ViewController: UIViewController { log.info("Info (Sensitive) button tapped", userInfo: Dev.dave | Tag.sensitive | Tag("informative")) } + @IBAction func noticeSensitiveButtonTouchUpInside(_ sender: AnyObject) { + log.notice("Notice (Sensitive) button tapped", userInfo: Dev.dave | Tag.sensitive) + } + @IBAction func warningSensitiveButtonTouchUpInside(_ sender: AnyObject) { // Can add a bunch of Dev/Tag objects log.warning("Warning (Sensitive) button tapped", userInfo: Dev.sabby | Dev.dave | Tag.sensitive | Tag.ui) @@ -104,6 +132,14 @@ class ViewController: UIViewController { log.severe("Severe (Sensitive) button tapped", userInfo: Tag.sensitive.dictionary) } + @IBAction func alertSensitiveButtonTouchUpInside(_ sender: AnyObject) { + log.alert("Alert (Sensitive) button tapped", userInfo: Dev.dave | Tag.sensitive) + } + + @IBAction func emergencySensitiveButtonTouchUpInside(_ sender: AnyObject) { + log.emergency("Emergency (Sensitive) button tapped", userInfo: Dev.dave | Tag.sensitive) + } + @IBAction func logLevelSliderValueChanged(_ sender: AnyObject) { var logLevel: XCGLogger.Level = .verbose @@ -117,14 +153,23 @@ class ViewController: UIViewController { logLevel = .info } else if (3 <= logLevelSlider.value && logLevelSlider.value < 4) { - logLevel = .warning + logLevel = .notice } else if (4 <= logLevelSlider.value && logLevelSlider.value < 5) { - logLevel = .error + logLevel = .warning } else if (5 <= logLevelSlider.value && logLevelSlider.value < 6) { + logLevel = .error + } + else if (6 <= logLevelSlider.value && logLevelSlider.value < 7) { logLevel = .severe } + else if (7 <= logLevelSlider.value && logLevelSlider.value < 8) { + logLevel = .alert + } + else if (8 <= logLevelSlider.value && logLevelSlider.value < 9) { + logLevel = .emergency + } else { logLevel = .none } diff --git a/DemoApps/iOSDemo/watchOSDemo Extension/InterfaceController.swift b/DemoApps/iOSDemo/watchOSDemo Extension/InterfaceController.swift index c7282b8a..fd16c995 100644 --- a/DemoApps/iOSDemo/watchOSDemo Extension/InterfaceController.swift +++ b/DemoApps/iOSDemo/watchOSDemo Extension/InterfaceController.swift @@ -57,6 +57,10 @@ class InterfaceController: WKInterfaceController { log.info("Info tapped on the Watch") } + @IBAction func noticeButtonTapped(_ sender: WKInterfaceButton) { + log.notice("Notice tapped on the Watch") + } + @IBAction func warningButtonTapped(_ sender: WKInterfaceButton) { log.warning("Warning tapped on the Watch") } @@ -68,4 +72,12 @@ class InterfaceController: WKInterfaceController { @IBAction func severeButtonTapped(_ sender: WKInterfaceButton) { log.severe("Severe tapped on the Watch") } + + @IBAction func alertButtonTapped(_ sender: WKInterfaceButton) { + log.alert("Alert tapped on the Watch") + } + + @IBAction func emergencyButtonTapped(_ sender: WKInterfaceButton) { + log.emergency("Emergency tapped on the Watch") + } } diff --git a/DemoApps/iOSDemo/watchOSDemo/Base.lproj/Interface.storyboard b/DemoApps/iOSDemo/watchOSDemo/Base.lproj/Interface.storyboard index 093db66e..ee474bcd 100644 --- a/DemoApps/iOSDemo/watchOSDemo/Base.lproj/Interface.storyboard +++ b/DemoApps/iOSDemo/watchOSDemo/Base.lproj/Interface.storyboard @@ -1,12 +1,10 @@ - - - - + + - - + + @@ -31,6 +29,11 @@ + + + diff --git a/DemoApps/macOSDemo/macOSDemo.xcodeproj/project.pbxproj b/DemoApps/macOSDemo/macOSDemo.xcodeproj/project.pbxproj index 48fd89c0..ea7e064e 100644 --- a/DemoApps/macOSDemo/macOSDemo.xcodeproj/project.pbxproj +++ b/DemoApps/macOSDemo/macOSDemo.xcodeproj/project.pbxproj @@ -282,7 +282,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1130; ORGANIZATIONNAME = "Cerebral Gardens"; TargetAttributes = { 555FFCAC19D77B1800F62246 = { @@ -298,10 +298,9 @@ }; buildConfigurationList = 555FFCA819D77B1800F62246 /* Build configuration list for PBXProject "macOSDemo" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ); @@ -497,7 +496,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -554,7 +553,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/DemoApps/macOSDemo/macOSDemo.xcodeproj/xcshareddata/xcschemes/macOSDemo.xcscheme b/DemoApps/macOSDemo/macOSDemo.xcodeproj/xcshareddata/xcschemes/macOSDemo.xcscheme index 807e06b5..007929fa 100644 --- a/DemoApps/macOSDemo/macOSDemo.xcodeproj/xcshareddata/xcschemes/macOSDemo.xcscheme +++ b/DemoApps/macOSDemo/macOSDemo.xcodeproj/xcshareddata/xcschemes/macOSDemo.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -53,17 +62,6 @@ - - - - - - - - - + - + + @@ -94,18 +95,19 @@ + - - + + - + - - + + @@ -115,8 +117,8 @@ - - + + @@ -126,8 +128,8 @@ - - + + @@ -138,17 +140,17 @@ - + - + + - + + @@ -250,6 +278,19 @@ + @@ -257,29 +298,38 @@ - + + + + + - + + + + + + @@ -290,7 +340,7 @@ - + diff --git a/DemoApps/tvOSDemo/tvOSDemo.xcodeproj/project.pbxproj b/DemoApps/tvOSDemo/tvOSDemo.xcodeproj/project.pbxproj index 1cd43f36..b01bdbf8 100644 --- a/DemoApps/tvOSDemo/tvOSDemo.xcodeproj/project.pbxproj +++ b/DemoApps/tvOSDemo/tvOSDemo.xcodeproj/project.pbxproj @@ -484,7 +484,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -541,7 +541,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/DemoApps/tvOSDemo/tvOSDemo/Base.lproj/Main.storyboard b/DemoApps/tvOSDemo/tvOSDemo/Base.lproj/Main.storyboard index 296f61d8..7ae227ff 100644 --- a/DemoApps/tvOSDemo/tvOSDemo/Base.lproj/Main.storyboard +++ b/DemoApps/tvOSDemo/tvOSDemo/Base.lproj/Main.storyboard @@ -1,7 +1,11 @@ - - + + + - + + + + @@ -16,70 +20,90 @@ - - + + - - - + - + + - - - - - - + - + @@ -88,7 +112,7 @@ - + diff --git a/DemoApps/tvOSDemo/tvOSDemo/ViewController.swift b/DemoApps/tvOSDemo/tvOSDemo/ViewController.swift index 1e58b6bf..9e8925bd 100644 --- a/DemoApps/tvOSDemo/tvOSDemo/ViewController.swift +++ b/DemoApps/tvOSDemo/tvOSDemo/ViewController.swift @@ -33,6 +33,10 @@ class ViewController: UIViewController { log.info("Info tapped on the TV") } + @IBAction func noticeButtonTapped(_ sender: UIButton) { + log.notice("Notice tapped on the TV") + } + @IBAction func warningButtonTapped(_ sender: UIButton) { log.warning("Warning tapped on the TV") } @@ -44,4 +48,12 @@ class ViewController: UIViewController { @IBAction func severeButtonTapped(_ sender: UIButton) { log.severe("Severe tapped on the TV") } + + @IBAction func alertButtonTapped(_ sender: UIButton) { + log.alert("Alert tapped on the TV") + } + + @IBAction func emergencyButtonTapped(_ sender: UIButton) { + log.emergency("Emergency tapped on the TV") + } } diff --git a/ObjcExceptionBridging.podspec b/ObjcExceptionBridging.podspec index 8a788dff..7f23f8b3 100644 --- a/ObjcExceptionBridging.podspec +++ b/ObjcExceptionBridging.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = 'ObjcExceptionBridging' - spec.version = '7.0.0' + spec.version = '7.0.1' spec.summary = 'A bridge to Objective-C exception handling, for use in Swift projects.' spec.description = <<-DESC @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| spec.platforms = { :ios => '8.0', :watchos => '2.0', :tvos => '9.0' } spec.requires_arc = true - spec.source = { :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :tag => '7.0.0' } + spec.source = { :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :tag => '7.0.1' } spec.ios.deployment_target = '8.0' spec.osx.deployment_target = '10.10' diff --git a/README.md b/README.md index ef38e96a..8511b6fa 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ in your repository folder. Add the following line to your `Cartfile`. -```github "DaveWoodCom/XCGLogger" ~> 7.0.0``` +```github "DaveWoodCom/XCGLogger" ~> 7.0.1``` Then run `carthage update --no-use-binaries` or just `carthage update`. For details of the installation and usage of Carthage, visit [its project page][carthage]. @@ -71,12 +71,12 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! -pod 'XCGLogger', '~> 7.0.0' +pod 'XCGLogger', '~> 7.0.1' ``` Specifying the pod `XCGLogger` on its own will include the core framework. We're starting to add subspecs to allow you to include optional components as well: -`pod 'XCGLogger/UserInfoHelpers', '~> 7.0.0'`: Include some experimental code to help deal with using UserInfo dictionaries to tag log messages. +`pod 'XCGLogger/UserInfoHelpers', '~> 7.0.1'`: Include some experimental code to help deal with using UserInfo dictionaries to tag log messages. Then run `pod install`. For details of the installation and usage of CocoaPods, visit [its official web site][cocoapods]. @@ -118,7 +118,7 @@ Add the following entry to your package's dependencies: ### Backwards Compatibility Use: -* XCGLogger version [7.0.0][xcglogger-7.0.0] for Swift 5.0 +* XCGLogger version [7.0.1][xcglogger-7.0.1] for Swift 5.0 * XCGLogger version [6.1.0][xcglogger-6.1.0] for Swift 4.2 * XCGLogger version [6.0.4][xcglogger-6.0.4] for Swift 4.1 * XCGLogger version [6.0.2][xcglogger-6.0.2] for Swift 4.0 @@ -568,9 +568,9 @@ The change log is now in its own file: [CHANGELOG.md](CHANGELOG.md) [badge-platforms]: https://img.shields.io/badge/Platforms-macOS%20%7C%20iOS%20%7C%20tvOS%20%7C%20watchOS-lightgray.svg?style=flat [badge-license]: https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat [badge-travis]: https://img.shields.io/travis/DaveWoodCom/XCGLogger/master.svg?style=flat -[badge-swiftpm]: https://img.shields.io/badge/Swift_Package_Manager-v7.0.0-64a6dd.svg?style=flat +[badge-swiftpm]: https://img.shields.io/badge/Swift_Package_Manager-v7.0.1-64a6dd.svg?style=flat [badge-cocoapods]: https://img.shields.io/cocoapods/v/XCGLogger.svg?style=flat -[badge-carthage]: https://img.shields.io/badge/Carthage-v7.0.0-64a6dd.svg?style=flat +[badge-carthage]: https://img.shields.io/badge/Carthage-v7.0.1-64a6dd.svg?style=flat [badge-sponsors]: https://img.shields.io/badge/Sponsors-Cerebral%20Gardens-orange.svg?style=flat [badge-mastodon]: https://img.shields.io/badge/Mastodon-DaveWoodX-606A84.svg?style=flat @@ -584,7 +584,7 @@ The change log is now in its own file: [CHANGELOG.md](CHANGELOG.md) [Firelog]: http://jogabo.github.io/firelog/ [Firebase]: https://www.firebase.com/ -[xcglogger-7.0.0]: https://github.com/DaveWoodCom/XCGLogger/releases/tag/7.0.0 +[xcglogger-7.0.1]: https://github.com/DaveWoodCom/XCGLogger/releases/tag/7.0.1 [xcglogger-6.1.0]: https://github.com/DaveWoodCom/XCGLogger/releases/tag/6.1.0 [xcglogger-6.0.4]: https://github.com/DaveWoodCom/XCGLogger/releases/tag/6.0.4 [xcglogger-6.0.2]: https://github.com/DaveWoodCom/XCGLogger/releases/tag/6.0.2 diff --git a/Sources/XCGLogger/XCGLogger.swift b/Sources/XCGLogger/XCGLogger.swift index 44ba76d7..b694b76b 100644 --- a/Sources/XCGLogger/XCGLogger.swift +++ b/Sources/XCGLogger/XCGLogger.swift @@ -46,7 +46,7 @@ open class XCGLogger: CustomDebugStringConvertible { public static let userInfoKeyInternal = "\(baseIdentifier).internal" /// Library version number - public static let versionString = "7.0.0" + public static let versionString = "7.0.1" /// Internal userInfo internal static let internalUserInfo: [String: Any] = [XCGLogger.Constants.userInfoKeyInternal: true] @@ -677,6 +677,95 @@ open class XCGLogger: CustomDebugStringConvertible { self.logln(.info, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) } + // MARK: * Notice + /// Log something at the Notice log level. This format of notice() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open class func notice(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.default.logln(.notice, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: self.default.noMessageClosure) + } + + /// Log something at the Notice log level. + /// + /// - Parameters: + /// - closure: A closure that returns the object to be logged. + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open class func notice(_ closure: @autoclosure () -> Any?, functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.default.logln(.notice, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Notice log level. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// - closure: A closure that returns the object to be logged. + /// + /// - Returns: Nothing. + /// + open class func notice(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:], closure: () -> Any?) { + self.default.logln(.notice, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Notice log level. This format of notice() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open func notice(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.logln(.notice, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: self.noMessageClosure) + } + + /// Log something at the Notice log level. + /// + /// - Parameters: + /// - closure: A closure that returns the object to be logged. + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open func notice(_ closure: @autoclosure () -> Any?, functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.logln(.notice, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Notice log level. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// - closure: A closure that returns the object to be logged. + /// + /// - Returns: Nothing. + /// + open func notice(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:], closure: () -> Any?) { + self.logln(.notice, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + // MARK: * Warning /// Log something at the Warning log level. This format of warning() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. /// @@ -944,6 +1033,184 @@ open class XCGLogger: CustomDebugStringConvertible { self.logln(.severe, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) } + // MARK: * Alert + /// Log something at the Alert log level. This format of alert() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open class func alert(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.default.logln(.alert, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: self.default.noMessageClosure) + } + + /// Log something at the Alert log level. + /// + /// - Parameters: + /// - closure: A closure that returns the object to be logged. + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open class func alert(_ closure: @autoclosure () -> Any?, functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.default.logln(.alert, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Alert log level. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// - closure: A closure that returns the object to be logged. + /// + /// - Returns: Nothing. + /// + open class func alert(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:], closure: () -> Any?) { + self.default.logln(.alert, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Alert log level. This format of alert() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open func alert(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.logln(.alert, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: self.noMessageClosure) + } + + /// Log something at the Alert log level. + /// + /// - Parameters: + /// - closure: A closure that returns the object to be logged. + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open func alert(_ closure: @autoclosure () -> Any?, functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.logln(.alert, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Alert log level. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// - closure: A closure that returns the object to be logged. + /// + /// - Returns: Nothing. + /// + open func alert(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:], closure: () -> Any?) { + self.logln(.alert, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + // MARK: * Emergency + /// Log something at the Emergency log level. This format of emergency() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open class func emergency(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.default.logln(.emergency, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: self.default.noMessageClosure) + } + + /// Log something at the Emergency log level. + /// + /// - Parameters: + /// - closure: A closure that returns the object to be logged. + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open class func emergency(_ closure: @autoclosure () -> Any?, functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.default.logln(.emergency, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Emergency log level. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// - closure: A closure that returns the object to be logged. + /// + /// - Returns: Nothing. + /// + open class func emergency(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:], closure: () -> Any?) { + self.default.logln(.emergency, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Emergency log level. This format of emergency() isn't provided the object to log, instead the property `noMessageClosure` is executed instead. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open func emergency(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.logln(.emergency, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: self.noMessageClosure) + } + + /// Log something at the Emergency log level. + /// + /// - Parameters: + /// - closure: A closure that returns the object to be logged. + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// + /// - Returns: Nothing. + /// + open func emergency(_ closure: @autoclosure () -> Any?, functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:]) { + self.logln(.emergency, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + + /// Log something at the Emergency log level. + /// + /// - Parameters: + /// - functionName: Normally omitted **Default:** *#function*. + /// - fileName: Normally omitted **Default:** *#file*. + /// - lineNumber: Normally omitted **Default:** *#line*. + /// - userInfo: Dictionary for adding arbitrary data to the log message, can be used by filters/formatters etc + /// - closure: A closure that returns the object to be logged. + /// + /// - Returns: Nothing. + /// + open func emergency(_ functionName: StaticString = #function, fileName: StaticString = #file, lineNumber: Int = #line, userInfo: [String: Any] = [:], closure: () -> Any?) { + self.logln(.emergency, functionName: functionName, fileName: fileName, lineNumber: lineNumber, userInfo: userInfo, closure: closure) + } + // MARK: - Exec Methods // MARK: * Verbose /// Execute some code only when at the Verbose log level. @@ -1014,6 +1281,29 @@ open class XCGLogger: CustomDebugStringConvertible { self.exec(XCGLogger.Level.info, closure: closure) } + // MARK: * Notice + /// Execute some code only when at the Notice or lower log level. + /// + /// - Parameters: + /// - closure: The code closure to be executed. + /// + /// - Returns: Nothing. + /// + open class func noticeExec(_ closure: () -> () = {}) { + self.default.exec(XCGLogger.Level.notice, closure: closure) + } + + /// Execute some code only when at the Notice or lower log level. + /// + /// - Parameters: + /// - closure: The code closure to be executed. + /// + /// - Returns: Nothing. + /// + open func noticeExec(_ closure: () -> () = {}) { + self.exec(XCGLogger.Level.notice, closure: closure) + } + // MARK: * Warning /// Execute some code only when at the Warning or lower log level. /// @@ -1083,6 +1373,52 @@ open class XCGLogger: CustomDebugStringConvertible { self.exec(XCGLogger.Level.severe, closure: closure) } + // MARK: * Alert + /// Execute some code only when at the Alert or lower log level. + /// + /// - Parameters: + /// - closure: The code closure to be executed. + /// + /// - Returns: Nothing. + /// + open class func alertExec(_ closure: () -> () = {}) { + self.default.exec(XCGLogger.Level.alert, closure: closure) + } + + /// Execute some code only when at the Alert or lower log level. + /// + /// - Parameters: + /// - closure: The code closure to be executed. + /// + /// - Returns: Nothing. + /// + open func alertExec(_ closure: () -> () = {}) { + self.exec(XCGLogger.Level.alert, closure: closure) + } + + // MARK: * Emergency + /// Execute some code only when at the Emergency or lower log level. + /// + /// - Parameters: + /// - closure: The code closure to be executed. + /// + /// - Returns: Nothing. + /// + open class func emergencyExec(_ closure: () -> () = {}) { + self.default.exec(XCGLogger.Level.emergency, closure: closure) + } + + /// Execute some code only when at the Emergency or lower log level. + /// + /// - Parameters: + /// - closure: The code closure to be executed. + /// + /// - Returns: Nothing. + /// + open func emergencyExec(_ closure: () -> () = {}) { + self.exec(XCGLogger.Level.emergency, closure: closure) + } + // MARK: - Log destination methods /// Get the destination with the specified identifier. /// diff --git a/XCGLogger.podspec b/XCGLogger.podspec index 043744d2..f76f1340 100644 --- a/XCGLogger.podspec +++ b/XCGLogger.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = 'XCGLogger' - spec.version = '7.0.0' + spec.version = '7.0.1' spec.summary = 'A debug log module for use in Swift projects.' spec.description = <<-DESC diff --git a/XCGLogger.xcodeproj/project.pbxproj b/XCGLogger.xcodeproj/project.pbxproj index 62dec380..04ba269e 100644 --- a/XCGLogger.xcodeproj/project.pbxproj +++ b/XCGLogger.xcodeproj/project.pbxproj @@ -1220,6 +1220,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; @@ -1246,6 +1247,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "iPhone Developer"; @@ -1272,6 +1274,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; @@ -1300,6 +1303,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; @@ -1430,7 +1434,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -1493,7 +1497,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 7.0.0; + CURRENT_PROJECT_VERSION = 7.0.1; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1525,6 +1529,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -1547,6 +1552,7 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -1595,6 +1601,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; @@ -1621,6 +1628,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer"; diff --git a/XCGLogger.xcodeproj/xcshareddata/xcschemes/ObjcExceptionBridging (iOS).xcscheme b/XCGLogger.xcodeproj/xcshareddata/xcschemes/ObjcExceptionBridging (iOS).xcscheme index 5f9c4014..a642e477 100644 --- a/XCGLogger.xcodeproj/xcshareddata/xcschemes/ObjcExceptionBridging (iOS).xcscheme +++ b/XCGLogger.xcodeproj/xcshareddata/xcschemes/ObjcExceptionBridging (iOS).xcscheme @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - + + + + @@ -53,17 +62,6 @@ - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -53,17 +62,6 @@ - - - - - - - - - - - - + + - -