diff --git a/Logger.xcodeproj/project.pbxproj b/Logger.xcodeproj/project.pbxproj index bc89d56..2236301 100644 --- a/Logger.xcodeproj/project.pbxproj +++ b/Logger.xcodeproj/project.pbxproj @@ -210,10 +210,11 @@ TargetAttributes = { 2E58D35921316C3500BEF81A = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1020; }; 2EBF4B392122AA34008E4117 = { CreatedOnToolsVersion = 10.0; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; }; }; }; @@ -299,7 +300,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.wnagrodzki.UnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -316,7 +317,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.wnagrodzki.UnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -452,7 +453,7 @@ SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "Logger/Logger-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -471,7 +472,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "Logger/Logger-Bridging-Header.h"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Logger/Logger.swift b/Logger/Logger.swift index 7953f48..4107095 100644 --- a/Logger/Logger.swift +++ b/Logger/Logger.swift @@ -107,7 +107,7 @@ extension Logger { public func log(_ message: @autoclosure () -> String, level: LogLevel, file: String = #file, line: Int = #line, function: String = #function) { let now = Date() let location = description(for: file, line: line, function: function) - log(time: now, level: level, location: location, message: message) + log(time: now, level: level, location: location, message: message()) } /// Returns location in format `": "`. diff --git a/Logger/Loggers/AgregateLogger.swift b/Logger/Loggers/AgregateLogger.swift index d9bffe4..eaba542 100644 --- a/Logger/Loggers/AgregateLogger.swift +++ b/Logger/Loggers/AgregateLogger.swift @@ -38,7 +38,7 @@ public final class AgregateLogger: Logger { public func log(time: Date, level: LogLevel, location: String, message: @autoclosure () -> String) { for logger in self.loggers { - logger.log(time: time, level: level, location: location, message: message) + logger.log(time: time, level: level, location: location, message: message()) } } } diff --git a/UnitTests/FileWriterTests.swift b/UnitTests/FileWriterTests.swift index cb3ebc7..222991c 100644 --- a/UnitTests/FileWriterTests.swift +++ b/UnitTests/FileWriterTests.swift @@ -39,7 +39,7 @@ class FileWriterTests: XCTestCase { func testKeepingFileSizeLimit() throws { let factory = FileMockFactory() let writer = try FileWriter(fileURL: logURL, fileSizeLimit: 1, fileFactory: factory) - let data = Data(bytes: [0]) + let data = Data([0]) try writer.write(data) XCTAssertEqual(factory.mock.writtenData, data) @@ -48,7 +48,7 @@ class FileWriterTests: XCTestCase { func testExceedingFileSizeLimit() throws { let factory = FileMockFactory() let writer = try FileWriter(fileURL: logURL, fileSizeLimit: 1, fileFactory: factory) - let data = Data(bytes: [0, 0]) + let data = Data([0, 0]) XCTAssertThrowsError(try writer.write(data), "file size limit exceeded") { (error) in XCTAssertTrue(error is SizeLimitedFileQuotaReached)