diff --git a/application/xiu/src/config/errors.rs b/application/xiu/src/config/errors.rs index 3481ff44..baa6768a 100644 --- a/application/xiu/src/config/errors.rs +++ b/application/xiu/src/config/errors.rs @@ -9,7 +9,7 @@ pub struct ConfigError { #[derive(Debug, Fail)] pub enum ConfigErrorValue { - #[fail(display = "IO error: {}\n", _0)] + #[fail(display = "IO error: {}", _0)] IOError(Error), } diff --git a/application/xiu/src/service.rs b/application/xiu/src/service.rs index 74fb6e3b..298d7238 100644 --- a/application/xiu/src/service.rs +++ b/application/xiu/src/service.rs @@ -111,7 +111,7 @@ impl Service { ); tokio::spawn(async move { if let Err(err) = push_client.run().await { - log::error!("push client error {}\n", err); + log::error!("push client error {}", err); } }); @@ -135,7 +135,7 @@ impl Service { tokio::spawn(async move { if let Err(err) = pull_client.run().await { - log::error!("pull client error {}\n", err); + log::error!("pull client error {}", err); } }); @@ -149,7 +149,7 @@ impl Service { let mut rtmp_server = RtmpServer::new(address, producer, gop_num); tokio::spawn(async move { if let Err(err) = rtmp_server.run().await { - log::error!("rtmp server error: {}\n", err); + log::error!("rtmp server error: {}", err); } }); } @@ -186,7 +186,7 @@ impl Service { tokio::spawn(async move { if let Err(err) = remuxer.run().await { - log::error!("rtmp remuxer server error: {}\n", err); + log::error!("rtmp remuxer server error: {}", err); } }); Ok(()) @@ -208,7 +208,7 @@ impl Service { let mut rtsp_server = RtspServer::new(address, producer); tokio::spawn(async move { if let Err(err) = rtsp_server.run().await { - log::error!("rtsp server error: {}\n", err); + log::error!("rtsp server error: {}", err); } }); } @@ -232,7 +232,7 @@ impl Service { let mut webrtc_server = WebRTCServer::new(address, producer); tokio::spawn(async move { if let Err(err) = webrtc_server.run().await { - log::error!("webrtc server error: {}\n", err); + log::error!("webrtc server error: {}", err); } }); } @@ -252,7 +252,7 @@ impl Service { tokio::spawn(async move { if let Err(err) = httpflv_server::run(event_producer, port).await { - log::error!("httpflv server error: {}\n", err); + log::error!("httpflv server error: {}", err); } }); } @@ -278,7 +278,7 @@ impl Service { tokio::spawn(async move { if let Err(err) = hls_remuxer.run().await { - log::error!("rtmp event processor error: {}\n", err); + log::error!("rtmp event processor error: {}", err); } }); @@ -286,7 +286,7 @@ impl Service { tokio::spawn(async move { if let Err(err) = hls_server::run(port).await { - log::error!("hls server error: {}\n", err); + log::error!("hls server error: {}", err); } }); stream_hub.set_hls_enabled(true); diff --git a/library/bytesio/src/bits_errors.rs b/library/bytesio/src/bits_errors.rs index d457c73e..dbab8046 100644 --- a/library/bytesio/src/bits_errors.rs +++ b/library/bytesio/src/bits_errors.rs @@ -5,15 +5,15 @@ use std::fmt; #[derive(Debug, Fail)] pub enum BitErrorValue { - #[fail(display = "bytes read error\n")] + #[fail(display = "bytes read error")] BytesReadError(BytesReadError), - #[fail(display = "bytes write error\n")] + #[fail(display = "bytes write error")] BytesWriteError(BytesWriteError), - #[fail(display = "the size is bigger than 64\n")] + #[fail(display = "the size is bigger than 64")] TooBig, - #[fail(display = "cannot write the whole 8 bits\n")] + #[fail(display = "cannot write the whole 8 bits")] CannotWrite8Bit, - #[fail(display = "cannot read byte\n")] + #[fail(display = "cannot read byte")] CannotReadByte, } #[derive(Debug)] diff --git a/library/bytesio/src/bytes_errors.rs b/library/bytesio/src/bytes_errors.rs index b8336917..e1c32e12 100644 --- a/library/bytesio/src/bytes_errors.rs +++ b/library/bytesio/src/bytes_errors.rs @@ -11,13 +11,13 @@ pub enum BytesReadErrorValue { NotEnoughBytes, #[fail(display = "empty stream")] EmptyStream, - #[fail(display = "io error: {}\n", _0)] + #[fail(display = "io error: {}", _0)] IO(#[cause] io::Error), #[fail(display = "index out of range")] IndexOutofRange, - #[fail(display = "bytesio read error: {}\n", _0)] + #[fail(display = "bytesio read error: {}", _0)] BytesIOError(BytesIOError), - // #[fail(display = "elapsed: {}\n", _0)] + // #[fail(display = "elapsed: {}", _0)] // TimeoutError(#[cause] Elapsed), } @@ -63,9 +63,9 @@ pub struct BytesWriteError { #[derive(Debug, Fail)] pub enum BytesWriteErrorValue { - #[fail(display = "io error\n")] + #[fail(display = "io error")] IO(io::Error), - #[fail(display = "not enough bytes to write: {}\n", _0)] + #[fail(display = "bytes io error: {}", _0)] BytesIOError(BytesIOError), #[fail(display = "write time out")] Timeout, diff --git a/library/bytesio/src/bytesio_errors.rs b/library/bytesio/src/bytesio_errors.rs index 27c15ccd..73fe415d 100644 --- a/library/bytesio/src/bytesio_errors.rs +++ b/library/bytesio/src/bytesio_errors.rs @@ -9,9 +9,9 @@ pub enum BytesIOErrorValue { NotEnoughBytes, #[fail(display = "empty stream")] EmptyStream, - #[fail(display = "io error\n")] + #[fail(display = "io error")] IOError(io::Error), - #[fail(display = "time out error\n")] + #[fail(display = "time out error")] TimeoutError(tokio::time::error::Elapsed), #[fail(display = "none return")] NoneReturn, diff --git a/library/codec/h264/src/errors.rs b/library/codec/h264/src/errors.rs index 180867cf..db35b19d 100644 --- a/library/codec/h264/src/errors.rs +++ b/library/codec/h264/src/errors.rs @@ -4,7 +4,7 @@ use std::fmt; #[derive(Debug, Fail)] pub enum H264ErrorValue { - #[fail(display = "bit error\n")] + #[fail(display = "bit error")] BitError(BitError), } #[derive(Debug)] diff --git a/library/container/flv/src/errors.rs b/library/container/flv/src/errors.rs index c905fd7c..1ac6d1b5 100644 --- a/library/container/flv/src/errors.rs +++ b/library/container/flv/src/errors.rs @@ -8,11 +8,11 @@ use { #[derive(Debug, Fail)] pub enum TagParseErrorValue { - #[fail(display = "bytes read error\n")] + #[fail(display = "bytes read error")] BytesReadError(BytesReadError), - #[fail(display = "tag data length error\n")] + #[fail(display = "tag data length error")] TagDataLength, - #[fail(display = "unknow tag type error\n")] + #[fail(display = "unknow tag type error")] UnknownTagType, } #[derive(Debug)] @@ -89,13 +89,13 @@ pub struct FlvDemuxerError { pub enum DemuxerErrorValue { // #[fail(display = "server error")] // Error, - #[fail(display = "bytes write error:{}\n", _0)] + #[fail(display = "bytes write error:{}", _0)] BytesWriteError(#[cause] BytesWriteError), - #[fail(display = "bytes read error:{}\n", _0)] + #[fail(display = "bytes read error:{}", _0)] BytesReadError(#[cause] BytesReadError), - #[fail(display = "mpeg avc error:{}\n", _0)] + #[fail(display = "mpeg avc error:{}", _0)] MpegAvcError(#[cause] Mpeg4AvcHevcError), - #[fail(display = "mpeg aac error:{}\n", _0)] + #[fail(display = "mpeg aac error:{}", _0)] MpegAacError(#[cause] MpegAacError), } @@ -149,19 +149,19 @@ impl Fail for FlvDemuxerError { #[derive(Debug, Fail)] pub enum MpegErrorValue { - #[fail(display = "bytes read error:{}\n", _0)] + #[fail(display = "bytes read error:{}", _0)] BytesReadError(#[cause] BytesReadError), - #[fail(display = "bytes write error:{}\n", _0)] + #[fail(display = "bytes write error:{}", _0)] BytesWriteError(#[cause] BytesWriteError), - #[fail(display = "bits error:{}\n", _0)] + #[fail(display = "bits error:{}", _0)] BitError(#[cause] BitError), - #[fail(display = "h264 error:{}\n", _0)] + #[fail(display = "h264 error:{}", _0)] H264Error(#[cause] H264Error), - #[fail(display = "there is not enough bits to read\n")] + #[fail(display = "there is not enough bits to read")] NotEnoughBitsToRead, - #[fail(display = "should not come here\n")] + #[fail(display = "should not come here")] ShouldNotComeHere, - #[fail(display = "the sps nal unit type is not correct\n")] + #[fail(display = "the sps nal unit type is not correct")] SPSNalunitTypeNotCorrect, } #[derive(Debug)] @@ -256,7 +256,7 @@ impl Fail for MpegAacError { #[derive(Debug, Fail)] pub enum BitVecErrorValue { - #[fail(display = "not enough bits left\n")] + #[fail(display = "not enough bits left")] NotEnoughBits, } #[derive(Debug)] diff --git a/library/container/mpegts/src/errors.rs b/library/container/mpegts/src/errors.rs index 0f458e71..6602b8a4 100644 --- a/library/container/mpegts/src/errors.rs +++ b/library/container/mpegts/src/errors.rs @@ -7,25 +7,25 @@ use { #[derive(Debug, Fail)] pub enum MpegTsErrorValue { - #[fail(display = "bytes read error\n")] + #[fail(display = "bytes read error")] BytesReadError(BytesReadError), - #[fail(display = "bytes write error\n")] + #[fail(display = "bytes write error")] BytesWriteError(BytesWriteError), - #[fail(display = "io error\n")] + #[fail(display = "io error")] IOError(Error), - #[fail(display = "program number exists\n")] + #[fail(display = "program number exists")] ProgramNumberExists, - #[fail(display = "pmt count execeed\n")] + #[fail(display = "pmt count execeed")] PmtCountExeceed, - #[fail(display = "stream count execeed\n")] + #[fail(display = "stream count execeed")] StreamCountExeceed, - #[fail(display = "stream not found\n")] + #[fail(display = "stream not found")] StreamNotFound, } #[derive(Debug)] diff --git a/library/streamhub/src/errors.rs b/library/streamhub/src/errors.rs index 43e293b7..e4a0837b 100644 --- a/library/streamhub/src/errors.rs +++ b/library/streamhub/src/errors.rs @@ -4,25 +4,25 @@ use bytesio::bytes_errors::BytesWriteError; use {failure::Fail, std::fmt}; #[derive(Debug, Fail)] pub enum ChannelErrorValue { - #[fail(display = "no app name\n")] + #[fail(display = "no app name")] NoAppName, - #[fail(display = "no stream name\n")] + #[fail(display = "no stream name")] NoStreamName, - #[fail(display = "no app or stream name\n")] + #[fail(display = "no app or stream name")] NoAppOrStreamName, - #[fail(display = "exists\n")] + #[fail(display = "exists")] Exists, - #[fail(display = "send error\n")] + #[fail(display = "send error")] SendError, - #[fail(display = "send video error\n")] + #[fail(display = "send video error")] SendVideoError, - #[fail(display = "send audio error\n")] + #[fail(display = "send audio error")] SendAudioError, - #[fail(display = "bytes read error\n")] + #[fail(display = "bytes read error")] BytesReadError(BytesReadError), - #[fail(display = "bytes write error\n")] + #[fail(display = "bytes write error")] BytesWriteError(BytesWriteError), - #[fail(display = "not correct data sender type\n")] + #[fail(display = "not correct data sender type")] NotCorrectDataSenderType, } #[derive(Debug)] diff --git a/library/streamhub/src/lib.rs b/library/streamhub/src/lib.rs index c4a1d0a4..2a8a45dc 100644 --- a/library/streamhub/src/lib.rs +++ b/library/streamhub/src/lib.rs @@ -353,7 +353,7 @@ impl StreamsHub { .insert(info.id, PubSubInfo::Publish { identifier }); } Err(err) => { - log::error!("event_loop Publish err: {}\n", err); + log::error!("event_loop Publish err: {}", err); continue; } } @@ -365,7 +365,7 @@ impl StreamsHub { } => { if let Err(err) = self.unpublish(&identifier) { log::error!( - "event_loop Unpublish err: {} with identifier: {} \n", + "event_loop Unpublish err: {} with identifier: {}", err, identifier ); @@ -489,7 +489,7 @@ impl StreamsHub { PubSubInfo::Publish { identifier } => { if let Err(err) = self.unpublish(&identifier) { log::error!( - "event_loop ApiKickClient pub err: {} with identifier: {} \n", + "event_loop ApiKickClient pub err: {} with identifier: {}", err, identifier ); @@ -501,7 +501,7 @@ impl StreamsHub { } => { if let Err(err) = self.unsubscribe(&identifier, sub_info) { log::error!( - "event_loop ApiKickClient pub err: {} with identifier: {}\n", + "event_loop ApiKickClient pub err: {} with identifier: {}", err, identifier ); diff --git a/protocol/hls/src/errors.rs b/protocol/hls/src/errors.rs index 37985e72..b90563e6 100644 --- a/protocol/hls/src/errors.rs +++ b/protocol/hls/src/errors.rs @@ -28,17 +28,17 @@ pub struct MediaError { pub enum MediaErrorValue { #[fail(display = "server error")] Error, - #[fail(display = "session error:{}\n", _0)] + #[fail(display = "session error:{}", _0)] SessionError(#[cause] SessionError), - #[fail(display = "amf write error:{}\n", _0)] + #[fail(display = "amf write error:{}", _0)] Amf0WriteError(#[cause] Amf0WriteError), - #[fail(display = "metadata error:{}\n", _0)] + #[fail(display = "metadata error:{}", _0)] MetadataError(#[cause] MetadataError), - #[fail(display = "flv demuxer error:{}\n", _0)] + #[fail(display = "flv demuxer error:{}", _0)] FlvDemuxerError(#[cause] FlvDemuxerError), - #[fail(display = "mpegts error:{}\n", _0)] + #[fail(display = "mpegts error:{}", _0)] MpegTsError(#[cause] MpegTsError), - #[fail(display = "write file error:{}\n", _0)] + #[fail(display = "write file error:{}", _0)] IOError(#[cause] std::io::Error), } @@ -114,17 +114,17 @@ pub struct HlsError { pub enum HlsErrorValue { #[fail(display = "hls error")] Error, - #[fail(display = "session error:{}\n", _0)] + #[fail(display = "session error:{}", _0)] SessionError(#[cause] SessionError), - #[fail(display = "amf write error:{}\n", _0)] + #[fail(display = "amf write error:{}", _0)] Amf0WriteError(#[cause] Amf0WriteError), - #[fail(display = "metadata error:{}\n", _0)] + #[fail(display = "metadata error:{}", _0)] MetadataError(#[cause] MetadataError), - #[fail(display = "flv demuxer error:{}\n", _0)] + #[fail(display = "flv demuxer error:{}", _0)] FlvDemuxerError(#[cause] FlvDemuxerError), - #[fail(display = "media error:{}\n", _0)] + #[fail(display = "media error:{}", _0)] MediaError(#[cause] MediaError), - #[fail(display = "receive error:{}\n", _0)] + #[fail(display = "receive error:{}", _0)] RecvError(#[cause] RecvError), } impl From for HlsError { diff --git a/protocol/hls/src/flv_data_receiver.rs b/protocol/hls/src/flv_data_receiver.rs index c658abe2..c2038019 100644 --- a/protocol/hls/src/flv_data_receiver.rs +++ b/protocol/hls/src/flv_data_receiver.rs @@ -152,7 +152,7 @@ impl FlvDataReceiver { info: sub_info, }; if let Err(err) = self.event_producer.send(subscribe_event) { - log::error!("unsubscribe_from_channels err {}\n", err); + log::error!("unsubscribe_from_channels err {}", err); } Ok(()) diff --git a/protocol/httpflv/src/httpflv.rs b/protocol/httpflv/src/httpflv.rs index de07d0f7..13133776 100644 --- a/protocol/httpflv/src/httpflv.rs +++ b/protocol/httpflv/src/httpflv.rs @@ -149,7 +149,7 @@ impl HttpFlv { info: sub_info, }; if let Err(err) = self.event_producer.send(subscribe_event) { - log::error!("unsubscribe_from_channels err {}\n", err); + log::error!("unsubscribe_from_channels err {}", err); } Ok(()) diff --git a/protocol/httpflv/src/server.rs b/protocol/httpflv/src/server.rs index d31a1fe7..3cb66da7 100644 --- a/protocol/httpflv/src/server.rs +++ b/protocol/httpflv/src/server.rs @@ -42,7 +42,7 @@ async fn handle_connection( tokio::spawn(async move { if let Err(err) = flv_hanlder.run().await { - log::error!("flv handler run error {}\n", err); + log::error!("flv handler run error {}", err); } }); diff --git a/protocol/rtmp/src/amf0/errors.rs b/protocol/rtmp/src/amf0/errors.rs index 06c74f93..6a4b0906 100644 --- a/protocol/rtmp/src/amf0/errors.rs +++ b/protocol/rtmp/src/amf0/errors.rs @@ -8,11 +8,11 @@ use { #[derive(Debug, Fail)] pub enum Amf0ReadErrorValue { - #[fail(display = "Encountered unknown marker: {}\n", marker)] + #[fail(display = "Encountered unknown marker: {}", marker)] UnknownMarker { marker: u8 }, - #[fail(display = "parser string error: {}\n", _0)] + #[fail(display = "parser string error: {}", _0)] StringParseError(#[cause] string::FromUtf8Error), - #[fail(display = "bytes read error :{}\n", _0)] + #[fail(display = "bytes read error :{}", _0)] BytesReadError(BytesReadError), #[fail(display = "wrong type")] WrongType, @@ -43,9 +43,9 @@ impl From for Amf0ReadError { pub enum Amf0WriteErrorValue { #[fail(display = "normal string too long")] NormalStringTooLong, - #[fail(display = "io error\n")] + #[fail(display = "io error")] BufferWriteError(io::Error), - #[fail(display = "bytes write error\n")] + #[fail(display = "bytes write error")] BytesWriteError(BytesWriteError), } diff --git a/protocol/rtmp/src/cache/errors.rs b/protocol/rtmp/src/cache/errors.rs index 40be5ca9..fa046418 100644 --- a/protocol/rtmp/src/cache/errors.rs +++ b/protocol/rtmp/src/cache/errors.rs @@ -9,17 +9,17 @@ use { #[derive(Debug, Fail)] pub enum CacheErrorValue { - #[fail(display = "cache tag parse error\n")] + #[fail(display = "cache tag parse error")] DemuxerError(FlvDemuxerError), - #[fail(display = "mpeg aac error\n")] + #[fail(display = "mpeg aac error")] MpegAacError(MpegAacError), - #[fail(display = "mpeg avc error\n")] + #[fail(display = "mpeg avc error")] MpegAvcError(Mpeg4AvcHevcError), - #[fail(display = "pack error\n")] + #[fail(display = "pack error")] PackError(PackError), - #[fail(display = "read bytes error\n")] + #[fail(display = "read bytes error")] BytesReadError(BytesReadError), - #[fail(display = "h264 error\n")] + #[fail(display = "h264 error")] H264Error(H264Error), } @@ -93,11 +93,11 @@ impl Fail for CacheError { #[derive(Debug, Fail)] pub enum MetadataErrorValue { - #[fail(display = "metadata tag parse error\n")] + #[fail(display = "metadata tag parse error")] DemuxerError(FlvDemuxerError), - #[fail(display = "pack error\n")] + #[fail(display = "pack error")] PackError(PackError), - #[fail(display = "amf write error\n")] + #[fail(display = "amf write error")] Amf0WriteError(Amf0WriteError), } #[derive(Debug)] diff --git a/protocol/rtmp/src/chunk/errors.rs b/protocol/rtmp/src/chunk/errors.rs index e1ddb859..294a9e9c 100644 --- a/protocol/rtmp/src/chunk/errors.rs +++ b/protocol/rtmp/src/chunk/errors.rs @@ -6,7 +6,7 @@ use { #[derive(Debug, Fail)] pub enum UnpackErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), #[fail(display = "unknow read state")] UnknowReadState, @@ -40,7 +40,7 @@ pub enum PackErrorValue { NotExistHeader, #[fail(display = "unknow read state")] UnknowReadState, - #[fail(display = "bytes writer error: {}\n", _0)] + #[fail(display = "bytes writer error: {}", _0)] BytesWriteError(BytesWriteError), } diff --git a/protocol/rtmp/src/handshake/errors.rs b/protocol/rtmp/src/handshake/errors.rs index 92a43a68..dc53a269 100644 --- a/protocol/rtmp/src/handshake/errors.rs +++ b/protocol/rtmp/src/handshake/errors.rs @@ -6,19 +6,19 @@ use { #[derive(Debug, Fail)] pub enum HandshakeErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(BytesWriteError), - #[fail(display = "system time error: {}\n", _0)] + #[fail(display = "system time error: {}", _0)] SysTimeError(SystemTimeError), - #[fail(display = "digest error: {}\n", _0)] + #[fail(display = "digest error: {}", _0)] DigestError(DigestError), - #[fail(display = "Digest not found error\n")] + #[fail(display = "Digest not found error")] DigestNotFound, - #[fail(display = "s0 version not correct error\n")] + #[fail(display = "s0 version not correct error")] S0VersionNotCorrect, - #[fail(display = "io error\n")] + #[fail(display = "io error")] IOError(Error), } @@ -96,13 +96,13 @@ pub struct DigestError { #[derive(Debug, Fail)] pub enum DigestErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), - #[fail(display = "digest length not correct\n")] + #[fail(display = "digest length not correct")] DigestLengthNotCorrect, - #[fail(display = "cannot generate digest\n")] + #[fail(display = "cannot generate digest")] CannotGenerate, - #[fail(display = "unknow schema\n")] + #[fail(display = "unknow schema")] UnknowSchema, } diff --git a/protocol/rtmp/src/messages/errors.rs b/protocol/rtmp/src/messages/errors.rs index fdb60c4d..df865569 100644 --- a/protocol/rtmp/src/messages/errors.rs +++ b/protocol/rtmp/src/messages/errors.rs @@ -11,17 +11,17 @@ use { #[derive(Debug, Fail)] pub enum MessageErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), #[fail(display = "unknow read state")] UnknowReadState, - #[fail(display = "amf0 read error: {}\n", _0)] + #[fail(display = "amf0 read error: {}", _0)] Amf0ReadError(Amf0ReadError), #[fail(display = "unknown message type")] UnknowMessageType, - #[fail(display = "protocol control message read error: {}\n", _0)] + #[fail(display = "protocol control message read error: {}", _0)] ProtocolControlMessageReaderError(ProtocolControlMessageReaderError), - #[fail(display = "user control message read error: {}\n", _0)] + #[fail(display = "user control message read error: {}", _0)] EventMessagesError(EventMessagesError), } diff --git a/protocol/rtmp/src/netconnection/errors.rs b/protocol/rtmp/src/netconnection/errors.rs index 117d154b..4517fdd6 100644 --- a/protocol/rtmp/src/netconnection/errors.rs +++ b/protocol/rtmp/src/netconnection/errors.rs @@ -13,11 +13,11 @@ pub struct NetConnectionError { } #[derive(Debug, Fail)] pub enum NetConnectionErrorValue { - #[fail(display = "amf0 write error: {}\n", _0)] + #[fail(display = "amf0 write error: {}", _0)] Amf0WriteError(Amf0WriteError), - #[fail(display = "amf0 read error: {}\n", _0)] + #[fail(display = "amf0 read error: {}", _0)] Amf0ReadError(Amf0ReadError), - #[fail(display = "pack error\n")] + #[fail(display = "pack error")] PackError(PackError), } diff --git a/protocol/rtmp/src/netstream/errors.rs b/protocol/rtmp/src/netstream/errors.rs index 443a0916..e33630ef 100644 --- a/protocol/rtmp/src/netstream/errors.rs +++ b/protocol/rtmp/src/netstream/errors.rs @@ -11,11 +11,11 @@ pub struct NetStreamError { #[derive(Debug, Fail)] pub enum NetStreamErrorValue { - #[fail(display = "amf0 write error: {}\n", _0)] + #[fail(display = "amf0 write error: {}", _0)] Amf0WriteError(Amf0WriteError), #[fail(display = "invalid max chunk size")] InvalidMaxChunkSize { chunk_size: usize }, - #[fail(display = "pack error\n")] + #[fail(display = "pack error")] PackError(PackError), } diff --git a/protocol/rtmp/src/protocol_control_messages/errors.rs b/protocol/rtmp/src/protocol_control_messages/errors.rs index 4213c333..df4f207e 100644 --- a/protocol/rtmp/src/protocol_control_messages/errors.rs +++ b/protocol/rtmp/src/protocol_control_messages/errors.rs @@ -12,7 +12,7 @@ pub struct ControlMessagesError { #[derive(Debug, Fail)] pub enum ControlMessagesErrorValue { //Amf0WriteError(Amf0WriteError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(BytesWriteError), } @@ -47,7 +47,7 @@ pub struct ProtocolControlMessageReaderError { #[derive(Debug, Fail)] pub enum ProtocolControlMessageReaderErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), } diff --git a/protocol/rtmp/src/relay/errors.rs b/protocol/rtmp/src/relay/errors.rs index bae5f954..a3a44963 100644 --- a/protocol/rtmp/src/relay/errors.rs +++ b/protocol/rtmp/src/relay/errors.rs @@ -17,12 +17,12 @@ impl fmt::Display for ClientError { #[derive(Debug, Fail)] pub enum PushClientErrorValue { - #[fail(display = "receive error\n")] + #[fail(display = "receive error")] ReceiveError(RecvError), - #[fail(display = "send error\n")] + #[fail(display = "send error")] SendError, - #[fail(display = "io error\n")] + #[fail(display = "io error")] IOError(Error), } diff --git a/protocol/rtmp/src/remuxer/errors.rs b/protocol/rtmp/src/remuxer/errors.rs index 7fbe0679..1252d28e 100644 --- a/protocol/rtmp/src/remuxer/errors.rs +++ b/protocol/rtmp/src/remuxer/errors.rs @@ -18,23 +18,23 @@ pub struct RtmpRemuxerError { pub enum RtmpRemuxerErrorValue { #[fail(display = "hls error")] Error, - #[fail(display = "session error:{}\n", _0)] + #[fail(display = "session error:{}", _0)] SessionError(#[cause] SessionError), - #[fail(display = "amf write error:{}\n", _0)] + #[fail(display = "amf write error:{}", _0)] Amf0WriteError(#[cause] Amf0WriteError), - #[fail(display = "metadata error:{}\n", _0)] + #[fail(display = "metadata error:{}", _0)] MetadataError(#[cause] MetadataError), - #[fail(display = "receive error:{}\n", _0)] + #[fail(display = "receive error:{}", _0)] RecvError(#[cause] RecvError), - #[fail(display = "bytes read error:{}\n", _0)] + #[fail(display = "bytes read error:{}", _0)] BytesReadError(#[cause] BytesReadError), - #[fail(display = "bytes write error:{}\n", _0)] + #[fail(display = "bytes write error:{}", _0)] BytesWriteError(#[cause] BytesWriteError), - #[fail(display = "mpeg avc error\n")] + #[fail(display = "mpeg avc error")] MpegAvcError(#[cause] Mpeg4AvcHevcError), - #[fail(display = "flv muxer error\n")] + #[fail(display = "flv muxer error")] FlvMuxerError(#[cause] FlvMuxerError), - #[fail(display = "stream hub event send error\n")] + #[fail(display = "stream hub event send error")] StreamHubEventSendErr, } impl From for RtmpRemuxerError { diff --git a/protocol/rtmp/src/remuxer/mod.rs b/protocol/rtmp/src/remuxer/mod.rs index 7facf884..94c2cc85 100644 --- a/protocol/rtmp/src/remuxer/mod.rs +++ b/protocol/rtmp/src/remuxer/mod.rs @@ -35,7 +35,7 @@ impl RtmpRemuxer { Rtsp2RtmpRemuxerSession::new(stream_path, self.event_producer.clone()); tokio::spawn(async move { if let Err(err) = session.run().await { - log::error!("rtsp2rtmp session error: {}\n", err); + log::error!("rtsp2rtmp session error: {}", err); } }); } diff --git a/protocol/rtmp/src/remuxer/rtsp2rtmp.rs b/protocol/rtmp/src/remuxer/rtsp2rtmp.rs index 160936d6..35457e73 100644 --- a/protocol/rtmp/src/remuxer/rtsp2rtmp.rs +++ b/protocol/rtmp/src/remuxer/rtsp2rtmp.rs @@ -161,7 +161,7 @@ impl Rtsp2RtmpRemuxerSession { info: sub_info, }; if let Err(err) = self.event_producer.send(subscribe_event) { - log::error!("unsubscribe_from_channels err {}\n", err); + log::error!("unsubscribe_from_channels err {}", err); } Ok(()) diff --git a/protocol/rtmp/src/session/common.rs b/protocol/rtmp/src/session/common.rs index 035b8f3c..0b20bd4c 100644 --- a/protocol/rtmp/src/session/common.rs +++ b/protocol/rtmp/src/session/common.rs @@ -204,7 +204,7 @@ impl Common { match self.data_sender.send(channel_data) { Ok(_) => {} Err(err) => { - log::error!("receive audio err {}\n", err); + log::error!("receive audio err {}", err); return Err(SessionError { value: SessionErrorValue::SendFrameDataErr, }); @@ -343,7 +343,7 @@ impl Common { info: self.get_subscriber_info(sub_id), }; if let Err(err) = self.event_producer.send(subscribe_event) { - log::error!("unsubscribe_from_channels err {}\n", err); + log::error!("unsubscribe_from_channels err {}", err); } Ok(()) diff --git a/protocol/rtmp/src/session/errors.rs b/protocol/rtmp/src/session/errors.rs index 54d54c3c..6ebd2fd0 100644 --- a/protocol/rtmp/src/session/errors.rs +++ b/protocol/rtmp/src/session/errors.rs @@ -22,53 +22,53 @@ pub struct SessionError { #[derive(Debug, Fail)] pub enum SessionErrorValue { - #[fail(display = "amf0 write error: {}\n", _0)] + #[fail(display = "amf0 write error: {}", _0)] Amf0WriteError(#[cause] Amf0WriteError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(#[cause] BytesWriteError), - // #[fail(display = "timeout error: {}\n", _0)] + // #[fail(display = "timeout error: {}", _0)] // TimeoutError(#[cause] Elapsed), - #[fail(display = "unpack error: {}\n", _0)] + #[fail(display = "unpack error: {}", _0)] UnPackError(#[cause] UnpackError), - #[fail(display = "message error: {}\n", _0)] + #[fail(display = "message error: {}", _0)] MessageError(#[cause] MessageError), - #[fail(display = "control message error: {}\n", _0)] + #[fail(display = "control message error: {}", _0)] ControlMessagesError(#[cause] ControlMessagesError), - #[fail(display = "net connection error: {}\n", _0)] + #[fail(display = "net connection error: {}", _0)] NetConnectionError(#[cause] NetConnectionError), - #[fail(display = "net stream error: {}\n", _0)] + #[fail(display = "net stream error: {}", _0)] NetStreamError(#[cause] NetStreamError), - #[fail(display = "event messages error: {}\n", _0)] + #[fail(display = "event messages error: {}", _0)] EventMessagesError(#[cause] EventMessagesError), - #[fail(display = "net io error: {}\n", _0)] + #[fail(display = "net io error: {}", _0)] BytesIOError(#[cause] BytesIOError), - #[fail(display = "pack error: {}\n", _0)] + #[fail(display = "pack error: {}", _0)] PackError(#[cause] PackError), - #[fail(display = "handshake error: {}\n", _0)] + #[fail(display = "handshake error: {}", _0)] HandshakeError(#[cause] HandshakeError), - #[fail(display = "cache error name: {}\n", _0)] + #[fail(display = "cache error name: {}", _0)] CacheError(#[cause] CacheError), - #[fail(display = "amf0 count not correct error\n")] + #[fail(display = "amf0 count not correct error")] Amf0ValueCountNotCorrect, - #[fail(display = "amf0 value type not correct error\n")] + #[fail(display = "amf0 value type not correct error")] Amf0ValueTypeNotCorrect, - #[fail(display = "stream hub event send error\n")] + #[fail(display = "stream hub event send error")] StreamHubEventSendErr, - #[fail(display = "none frame data sender error\n")] + #[fail(display = "none frame data sender error")] NoneFrameDataSender, - #[fail(display = "none frame data receiver error\n")] + #[fail(display = "none frame data receiver error")] NoneFrameDataReceiver, - #[fail(display = "send frame data error\n")] + #[fail(display = "send frame data error")] SendFrameDataErr, - #[fail(display = "subscribe count limit is reached.\n")] + #[fail(display = "subscribe count limit is reached.")] SubscribeCountLimitReach, - #[fail(display = "no app name error\n")] + #[fail(display = "no app name error")] NoAppName, - #[fail(display = "no media data can be received now.\n")] + #[fail(display = "no media data can be received now.")] NoMediaDataReceived, #[fail(display = "session is finished.")] diff --git a/protocol/rtmp/src/user_control_messages/errors.rs b/protocol/rtmp/src/user_control_messages/errors.rs index fe3d671b..4cb88c00 100644 --- a/protocol/rtmp/src/user_control_messages/errors.rs +++ b/protocol/rtmp/src/user_control_messages/errors.rs @@ -12,11 +12,11 @@ pub struct EventMessagesError { #[derive(Debug, Fail)] pub enum EventMessagesErrorValue { - #[fail(display = "amf0 write error: {}\n", _0)] + #[fail(display = "amf0 write error: {}", _0)] Amf0WriteError(Amf0WriteError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(BytesWriteError), - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), #[fail(display = "unknow event message type")] UnknowEventMessageType, diff --git a/protocol/rtmp/src/utils/errors.rs b/protocol/rtmp/src/utils/errors.rs index ecccde5a..766c0958 100644 --- a/protocol/rtmp/src/utils/errors.rs +++ b/protocol/rtmp/src/utils/errors.rs @@ -9,7 +9,7 @@ pub struct RtmpUrlParseError { } #[derive(Debug, Fail)] pub enum RtmpUrlParseErrorValue { - #[fail(display = "The url is not valid\n")] + #[fail(display = "The url is not valid")] Notvalid, } diff --git a/protocol/rtsp/src/rtp/errors.rs b/protocol/rtsp/src/rtp/errors.rs index 89b0d294..ed42b83c 100644 --- a/protocol/rtsp/src/rtp/errors.rs +++ b/protocol/rtsp/src/rtp/errors.rs @@ -29,9 +29,9 @@ impl fmt::Display for PackerError { #[derive(Debug, Fail)] pub enum PackerErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(#[cause] BytesWriteError), } @@ -58,9 +58,9 @@ pub struct UnPackerError { #[derive(Debug, Fail)] pub enum UnPackerErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(#[cause] BytesWriteError), } diff --git a/protocol/rtsp/src/rtp/rtcp/errors.rs b/protocol/rtsp/src/rtp/rtcp/errors.rs index 059b1c34..9827253b 100644 --- a/protocol/rtsp/src/rtp/rtcp/errors.rs +++ b/protocol/rtsp/src/rtp/rtcp/errors.rs @@ -9,9 +9,9 @@ pub struct RtcpError { #[derive(Debug, Fail)] pub enum RtcpErrorValue { - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(BytesReadError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(BytesWriteError), } diff --git a/protocol/rtsp/src/session/errors.rs b/protocol/rtsp/src/session/errors.rs index b813e8e3..eb428e2a 100644 --- a/protocol/rtsp/src/session/errors.rs +++ b/protocol/rtsp/src/session/errors.rs @@ -14,21 +14,21 @@ pub struct SessionError { #[derive(Debug, Fail)] pub enum SessionErrorValue { - #[fail(display = "net io error: {}\n", _0)] + #[fail(display = "net io error: {}", _0)] BytesIOError(#[cause] BytesIOError), - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(#[cause] BytesReadError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(#[cause] BytesWriteError), - #[fail(display = "Utf8Error: {}\n", _0)] + #[fail(display = "Utf8Error: {}", _0)] Utf8Error(#[cause] Utf8Error), - #[fail(display = "UnPackerError: {}\n", _0)] + #[fail(display = "UnPackerError: {}", _0)] UnPackerError(#[cause] UnPackerError), - #[fail(display = "stream hub event send error\n")] + #[fail(display = "stream hub event send error")] StreamHubEventSendErr, - #[fail(display = "cannot receive frame data from stream hub\n")] + #[fail(display = "cannot receive frame data from stream hub")] CannotReceiveFrameData, - #[fail(display = "pack error: {}\n", _0)] + #[fail(display = "pack error: {}", _0)] PackerError(#[cause] PackerError), } diff --git a/protocol/rtsp/src/session/mod.rs b/protocol/rtsp/src/session/mod.rs index 177648a3..441b5107 100644 --- a/protocol/rtsp/src/session/mod.rs +++ b/protocol/rtsp/src/session/mod.rs @@ -536,7 +536,7 @@ impl RtspServerSession { info: self.get_subscriber_info(), }; if let Err(err) = self.event_producer.send(subscribe_event) { - log::error!("unsubscribe_from_stream_hub err {}\n", err); + log::error!("unsubscribe_from_stream_hub err {}", err); } Ok(()) diff --git a/protocol/webrtc/src/errors.rs b/protocol/webrtc/src/errors.rs index 2ce93a95..ccb5fae8 100644 --- a/protocol/webrtc/src/errors.rs +++ b/protocol/webrtc/src/errors.rs @@ -12,11 +12,11 @@ pub struct WebRTCError { #[derive(Debug, Fail)] pub enum WebRTCErrorValue { - #[fail(display = "webrtc error: {}\n", _0)] + #[fail(display = "webrtc error: {}", _0)] RTCError(#[cause] RTCError), - #[fail(display = "webrtc util error: {}\n", _0)] + #[fail(display = "webrtc util error: {}", _0)] RTCUtilError(#[cause] RTCUtilError), - #[fail(display = "cannot get local description\n")] + #[fail(display = "cannot get local description")] CanNotGetLocalDescription, } diff --git a/protocol/webrtc/src/session/errors.rs b/protocol/webrtc/src/session/errors.rs index c367d64a..41fb3c84 100644 --- a/protocol/webrtc/src/session/errors.rs +++ b/protocol/webrtc/src/session/errors.rs @@ -14,27 +14,27 @@ pub struct SessionError { #[derive(Debug, Fail)] pub enum SessionErrorValue { - #[fail(display = "net io error: {}\n", _0)] + #[fail(display = "net io error: {}", _0)] BytesIOError(#[cause] BytesIOError), - #[fail(display = "bytes read error: {}\n", _0)] + #[fail(display = "bytes read error: {}", _0)] BytesReadError(#[cause] BytesReadError), - #[fail(display = "bytes write error: {}\n", _0)] + #[fail(display = "bytes write error: {}", _0)] BytesWriteError(#[cause] BytesWriteError), - #[fail(display = "Utf8Error: {}\n", _0)] + #[fail(display = "Utf8Error: {}", _0)] Utf8Error(#[cause] Utf8Error), - #[fail(display = "webrtc error: {}\n", _0)] + #[fail(display = "webrtc error: {}", _0)] RTCError(#[cause] RTCError), - #[fail(display = "stream hub event send error\n")] + #[fail(display = "stream hub event send error")] StreamHubEventSendErr, - #[fail(display = "cannot receive frame data from stream hub\n")] + #[fail(display = "cannot receive frame data from stream hub")] CannotReceiveFrameData, - #[fail(display = "Http Request path error\n")] + #[fail(display = "Http Request path error")] HttpRequestPathError, - #[fail(display = "Not supported\n")] + #[fail(display = "Not supported")] HttpRequestNotSupported, - #[fail(display = "Empty sdp data\n")] + #[fail(display = "Empty sdp data")] HttpRequestEmptySdp, - #[fail(display = "Cannot find Content-Length\n")] + #[fail(display = "Cannot find Content-Length")] HttpRequestNoContentLength, }