diff --git a/CHANGELOG.md b/CHANGELOG.md index 04dfd9e..025fb9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [x.y.z](https://github.com/sushichop/Puppy/releases/tag/x.y.z) (yyyy-mm-dd) + +- Remove concurrency features. [#39](https://github.com/sushichop/Puppy/pull/39) + ## [0.4.0](https://github.com/sushichop/Puppy/releases/tag/0.4.0) (2022-01-31) - `FileRotatonLogger` inherits `FileLogger`. [#29](https://github.com/sushichop/Puppy/pull/29) diff --git a/Sources/Puppy/FileLogger.swift b/Sources/Puppy/FileLogger.swift index 02ac1f9..362bade 100644 --- a/Sources/Puppy/FileLogger.swift +++ b/Sources/Puppy/FileLogger.swift @@ -68,22 +68,6 @@ public class FileLogger: BaseLogger { } } - #if compiler(>=5.5.2) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - public func delete(_ url: URL) async throws -> URL { - try await withCheckedThrowingContinuation { continuation in - queue!.async { - do { - try FileManager.default.removeItem(at: url) - continuation.resume(returning: url) - } catch { - continuation.resume(throwing: FileDeletingError.failed(at: url)) - } - } - } - } - #endif - public func flush() { queue!.sync { fileHandle?.synchronizeFile() @@ -96,17 +80,6 @@ public class FileLogger: BaseLogger { } } - #if compiler(>=5.5.2) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - public func flush() async { - await withCheckedContinuation { continuation in - queue!.async { - continuation.resume() - } - } - } - #endif - func openFile() throws { closeFile() let directoryURL = fileURL.deletingLastPathComponent() diff --git a/Tests/PuppyTests/FileLoggerTests.swift b/Tests/PuppyTests/FileLoggerTests.swift index 5e597fe..1d64157 100644 --- a/Tests/PuppyTests/FileLoggerTests.swift +++ b/Tests/PuppyTests/FileLoggerTests.swift @@ -180,30 +180,6 @@ final class FileLoggerTests: XCTestCase { wait(for: [expSuccess, expFailure], timeout: 5.0) } - #if compiler(>=5.5.2) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - func testDeletingFileAsyncAwait() async throws { - let existentFileURL = URL(fileURLWithPath: "./existent-async-await.log").absoluteURL - let noExistentFileURL = URL(fileURLWithPath: "./no-existent-async-await.log").absoluteURL - let fileLogger = try FileLogger("com.example.yourapp.filelogger.deletingasyncawait", fileURL: existentFileURL) - - do { - let url = try await fileLogger.delete(existentFileURL) - XCTAssertEqual(url, existentFileURL) - } catch { - XCTFail("error should not be thrown, but it was thrown: \(error.localizedDescription)") - } - - do { - _ = try await fileLogger.delete(noExistentFileURL) - XCTFail("error should be thrown while awaiting, but it was not thrown") - } catch { - XCTAssertEqual(error as? FileDeletingError, .failed(at: noExistentFileURL)) - XCTAssertEqual(error.localizedDescription, "failed to delete the file: \(noExistentFileURL)") - } - } - #endif - func testFlushFile() throws { let flushFileURL = URL(fileURLWithPath: "./flush.log").absoluteURL let fileLogger = try FileLogger("com.example.yourapp.filelogger.flush", fileURL: flushFileURL, flushMode: .manual) @@ -238,22 +214,6 @@ final class FileLoggerTests: XCTestCase { wait(for: [exp], timeout: 5.0) } - #if compiler(>=5.5.2) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - func testFlushFileAsyncAwait() async throws { - let fileURL = URL(fileURLWithPath: "./flush-async-await.log").absoluteURL - let fileLogger = try FileLogger("com.example.yourapp.filelogger.flushasyncawait", fileURL: fileURL, flushMode: .manual) - let log = Puppy() - log.add(fileLogger) - log.trace("flushAsyncAwait, TRACE message using FileLogger") - log.verbose("flushAsyncAwait, VERBOSE message using FileLogger") - - await fileLogger.flush() - _ = try await fileLogger.delete(fileURL) - log.remove(fileLogger) - } - #endif - func testFilePermssion() throws { let fileURL = URL(fileURLWithPath: "./permisson600.log").absoluteURL let fileLogger = try FileLogger("com.example.yourapp.filelogger.permisson600", fileURL: fileURL, filePermisson: "600")