         guard let valid_logFilePath: String = SingleFileLogWriterImpl.logFilePath() else {
             return
         }
-        let fm = FileManager.default
-        guard fm.fileExists(atPath: valid_logFilePath) else {
+        guard SingleFileLogWriterImpl.logFileMaxSizeInBytes > 0 else {
             return
         }
         let fileSize: UInt64 = SingleFileLogWriterImpl.fileSize(at: valid_logFilePath)
-        
-        guard SingleFileLogWriterImpl.logFileMaxSizeInBytes > 0 else {
-            return
-        }
         guard fileSize > SingleFileLogWriterImpl.logFileMaxSizeInBytes else {
             return
         }
-        
-        do {
-            try fm.removeItem(atPath: valid_logFilePath)
-        }
-        catch {
-            print("error:\(error)")
-        }
+        WriterUtils.removeFile(at: valid_logFilePath)
     }
     
     fileprivate static func fileSize(at path: String) -> UInt64 {
-        let fm: FileManager = FileManager.default
-        guard fm.fileExists(atPath: path) else {
-            return 0
-        }
-        guard let valid_attributes: [FileAttributeKey: Any] = try? fm.attributesOfItem(atPath: path) else {
-            return 0
-        }
-        guard let valid_fileSize: UInt64 = valid_attributes[FileAttributeKey.size] as? UInt64 else {
-            return 0
-        }
-        return valid_fileSize
+        return WriterUtils.fileSize(at: path)
     }
 }
 

            print(message)
            return
        }
        let fm = FileManager.default
        if !fm.fileExists(atPath: valid_logFilePath) {
            do {
                try "".write(toFile: valid_logFilePath, atomically: true, encoding: String.Encoding.utf8)
            }
            catch {
                print("error:\(error)")
            }
        }
        guard fm.isWritableFile(atPath: valid_logFilePath) else {
            return
        }
        guard let valid_fileHandle = FileHandle(forWritingAtPath: valid_logFilePath) else {
            let message: String = "Unable to obtain valid \(String(describing: FileHandle.self)) object!"
            print(message)
            return
        }
        let stringToWrite = "\(candidate)\n"
        valid_fileHandle.seekToEndOfFile()
        
        guard let valid_data: Data = stringToWrite.data(using: String.Encoding.utf8) else {
            let message: String = "Unable to obtain valid \(String(describing: Data.self)) object from candidate=\(stringToWrite)!"
            print(message)
            return
        }
        valid_fileHandle.write(valid_data)
        valid_fileHandle.closeFile()
        
        SingleFileLogWriterImpl.cleanUpIfNeeded()
    }
    
    fileprivate static func createLogsDirecotry(at path: String) {
        guard !SingleFileLogWriterImpl.didCreateLogsDirectory else {
            return
        }
        
        let fm: FileManager = FileManager.default
        if !fm.fileExists(atPath: path) {
            do {
                try fm.createDirectory(atPath: path, withIntermediateDirectories: false, attributes: nil)
                SingleFileLogWriterImpl.didCreateLogsDirectory = true
            }
            catch {
                print("error:\(error)")
            }
        }
        else {
            SingleFileLogWriterImpl.didCreateLogsDirectory = true
        }
    }
    
    fileprivate static func logFilePath() -> String? {

    
    // MARK: - Utils
    static func currentDirectoryPath(from candidate: String) -> String? {
        return WriterUtils.directoryPath(from: candidate)
    }
    
    static func writeToFile(_ candidate: String) {
