@@ -8,8 +8,6 @@ import { Uint8ArrayList } from 'uint8arraylist'
88import { Message } from './pb/message.js'
99import type { Direction } from '@libp2p/interface/connection'
1010
11- const log = logger ( 'libp2p:webrtc:stream' )
12-
1311export interface DataChannelOpts {
1412 maxMessageSize : number
1513 maxBufferedAmount : number
@@ -92,7 +90,7 @@ export class WebRTCStream extends AbstractStream {
9290 break
9391
9492 default :
95- log . error ( 'unknown datachannel state %s' , this . channel . readyState )
93+ this . log . error ( 'unknown datachannel state %s' , this . channel . readyState )
9694 throw new CodeError ( 'Unknown datachannel state' , 'ERR_INVALID_STATE' )
9795 }
9896
@@ -112,7 +110,7 @@ export class WebRTCStream extends AbstractStream {
112110
113111 this . channel . onclose = ( _evt ) => {
114112 void this . close ( ) . catch ( err => {
115- log . error ( 'error closing stream after channel closed' , err )
113+ this . log . error ( 'error closing stream after channel closed' , err )
116114 } )
117115 }
118116
@@ -145,7 +143,7 @@ export class WebRTCStream extends AbstractStream {
145143 }
146144 } )
147145 . catch ( err => {
148- log . error ( 'error processing incoming data channel messages' , err )
146+ this . log . error ( 'error processing incoming data channel messages' , err )
149147 } )
150148 }
151149
@@ -183,7 +181,7 @@ export class WebRTCStream extends AbstractStream {
183181
184182 this . messageQueue . append ( data )
185183 } else {
186- log . error ( 'unknown datachannel state %s' , this . channel . readyState )
184+ this . log . error ( 'unknown datachannel state %s' , this . channel . readyState )
187185 throw new CodeError ( 'Unknown datachannel state' , 'ERR_INVALID_STATE' )
188186 }
189187 }
@@ -242,7 +240,7 @@ export class WebRTCStream extends AbstractStream {
242240 }
243241
244242 private async _sendFlag ( flag : Message . Flag ) : Promise < void > {
245- log . trace ( 'Sending flag: %s' , flag . toString ( ) )
243+ this . log . trace ( 'Sending flag: %s' , flag . toString ( ) )
246244 const msgbuf = Message . encode ( { flag } )
247245 const prefixedBuf = lengthPrefixed . encode . single ( msgbuf )
248246
0 commit comments