View test reports →

Coverage Summary for Class: LoggingSendChannel (dev.skymansandy.wiretap.plugin.ws.util)

Class Class, % Method, % Branch, % Line, % Instruction, %
LoggingSendChannel 100% (1/1) 100% (2/2) 100% (5/5) 100% (23/23)


 /*
  * Copyright (c) 2026 skymansandy. All rights reserved.
  */
 
 package dev.skymansandy.wiretap.plugin.ws.util
 
 import io.ktor.websocket.Frame
 import kotlinx.coroutines.channels.SendChannel
 
 /**
  * Wraps a [SendChannel] to log frames before they are sent.
  */
 internal class LoggingSendChannel(
     private val delegate: SendChannel<Frame>,
     private val logAction: (Frame) -> Unit,
 ) : SendChannel<Frame> by delegate {
 
     override suspend fun send(element: Frame) {
         logAction(element)
         delegate.send(element)
     }
 }