     
     // MARK: - Utils
     static func currentDirectoryPath(from candidate: String) -> String? {
-        guard let valid_url = URL(string: candidate) else {
-            return nil
-        }
-        let pathComponents: [String] = valid_url.pathComponents
-        let folderPath: String
-        let fm = FileManager.default
-        if fm.fileExists(atPath: valid_url.absoluteString) {
-            folderPath = "/\(pathComponents[1..<pathComponents.count-1].joined(separator: "/"))"
-        }
-        else {
-            folderPath = "/\(pathComponents[1..<pathComponents.count].joined(separator: "/"))"
-        }
-        return folderPath
+        return WriterUtils.directoryPath(from: candidate)
     }
     
     static func writeToFile(_ candidate: String) {

        guard let valid_logFilePath: String = SingleFileLogWriterImpl.logFilePath() else {
            return
        }
        let fm = FileManager.default
        guard fm.fileExists(atPath: valid_logFilePath) 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)")
        }
    }
    
    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
    }
}


    fileprivate static var logsDirectoryPath: String = ""
    static func update_logsDirectoryPath(_ newValue: String) {
        SingleFileLogWriterImpl.logsDirectoryPath = newValue
        guard SingleFileLogWriterImpl.logsDirectoryPath.count > 0 else {
            return
        }
        SingleFileLogWriterImpl.createLogsDirectory(at: self.logsDirectoryPath)
    }
    
    fileprivate static var logFileName: String = Constants.logFileDefaultName
