         let logTag = Int(truncatingBitPattern: time)
         logsToShip[logTag] = dict
     }
-    
-    func dataToShip(_ dict: [String: Any]) -> Data {
-        
-        var data = Data()
-        
-        do {
-            data = try JSONSerialization.data(withJSONObject:dict, options:[])
-            
-            if let encodedData = "\n".data(using: String.Encoding.utf8) {
-                data.append(encodedData)
-            }
-        } catch {
-            print(error.localizedDescription)
-        }
-        
-        return data
-    }
-    
 }
 
 // MARK: - GCDAsyncSocketManager Delegate

    }
    
    func writeLogs() {
        
        self.logDispatchQueue.addOperation{ [weak self, weak socketManager] in
            guard let logsToShip = self?.logsToShip else { return }
            guard let dataToShip = self?.dataToShip else { return }
            guard let socketManager = socketManager else { return }

            for log in logsToShip.sorted(by: { $0.0 < $1.0 }) {
                let logData = dataToShip(log.1)
                socketManager.write(logData, withTimeout: socketManager.timeout, tag: log.0)
            }
            

    }
    
    public func cancelSending() {
        logDispatchQueue.cancelAllOperations()
        socketManager.disconnect()
    }
    
    // MARK: - Log dispatching
