mirror of
https://github.com/wnagrodzki/SwiftLogger.git
synced 2025-04-06 12:31:51 +02:00
Rename FileFactory to FileHandleFactory
This commit is contained in:
parent
3f90ca9fa6
commit
b49971f839
3 changed files with 6 additions and 6 deletions
|
@ -143,11 +143,11 @@ private class FileRotateFactory: LogrotateFactory {
|
|||
|
||||
private class FileWriterFactory: SizeLimitedFileFactory {
|
||||
func makeInstance(fileURL: URL, fileSizeLimit: UInt64) throws -> SizeLimitedFile {
|
||||
return try SizeLimitedFileImpl(fileURL: fileURL, fileSizeLimit: fileSizeLimit, fileFactory: FileHandleFactory())
|
||||
return try SizeLimitedFileImpl(fileURL: fileURL, fileSizeLimit: fileSizeLimit, fileFactory: FileHandleFactoryImpl())
|
||||
}
|
||||
}
|
||||
|
||||
private class FileHandleFactory: FileFactory {
|
||||
private class FileHandleFactoryImpl: FileHandleFactory {
|
||||
func makeInstance(forWritingTo: URL) throws -> OSFileHandle {
|
||||
return try FileHandle(forWritingTo: forWritingTo)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
protocol FileFactory {
|
||||
protocol FileHandleFactory {
|
||||
func makeInstance(forWritingTo: URL) throws -> OSFileHandle
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ final class SizeLimitedFileImpl {
|
|||
/// - fileURL: URL of the file.
|
||||
/// - fileSizeLimit: Maximum size the file can reach in bytes.
|
||||
/// - Throws: An error that may occur while the file is being opened for writing.
|
||||
init(fileURL: URL, fileSizeLimit: UInt64, fileFactory: FileFactory) throws {
|
||||
init(fileURL: URL, fileSizeLimit: UInt64, fileFactory: FileHandleFactory) throws {
|
||||
file = try fileFactory.makeInstance(forWritingTo: fileURL)
|
||||
self.sizeLimit = fileSizeLimit
|
||||
currentSize = file.seekToEndOfFile()
|
||||
|
|
|
@ -65,7 +65,7 @@ class SizeLimitedFileTests: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private class UnopenableFileFactory: FileFactory {
|
||||
private class UnopenableFileFactory: FileHandleFactory {
|
||||
|
||||
struct OpenFileError: Error {}
|
||||
|
||||
|
@ -74,7 +74,7 @@ private class UnopenableFileFactory: FileFactory {
|
|||
}
|
||||
}
|
||||
|
||||
private class FileMockFactory: FileFactory {
|
||||
private class FileMockFactory: FileHandleFactory {
|
||||
|
||||
let mock = FileMock()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue