Skip to content

Commit

Permalink
remove no used "\n" which can add blank lines when print logs
Browse files Browse the repository at this point in the history
  • Loading branch information
harlanc committed Nov 4, 2023
1 parent 35a2434 commit f38d38a
Show file tree
Hide file tree
Showing 36 changed files with 183 additions and 183 deletions.
2 changes: 1 addition & 1 deletion application/xiu/src/config/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down
18 changes: 9 additions & 9 deletions application/xiu/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

Expand All @@ -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);
}
});

Expand All @@ -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);
}
});
}
Expand Down Expand Up @@ -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(())
Expand All @@ -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);
}
});
}
Expand All @@ -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);
}
});
}
Expand All @@ -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);
}
});
}
Expand All @@ -278,15 +278,15 @@ 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);
}
});

let port = hls_cfg_value.port;

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);
Expand Down
10 changes: 5 additions & 5 deletions library/bytesio/src/bits_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
10 changes: 5 additions & 5 deletions library/bytesio/src/bytes_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions library/bytesio/src/bytesio_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion library/codec/h264/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
30 changes: 15 additions & 15 deletions library/container/flv/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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),
}

Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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)]
Expand Down
14 changes: 7 additions & 7 deletions library/container/mpegts/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
20 changes: 10 additions & 10 deletions library/streamhub/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
8 changes: 4 additions & 4 deletions library/streamhub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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
);
Expand Down Expand Up @@ -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
);
Expand All @@ -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
);
Expand Down
24 changes: 12 additions & 12 deletions protocol/hls/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down Expand Up @@ -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<RecvError> for HlsError {
Expand Down
2 changes: 1 addition & 1 deletion protocol/hls/src/flv_data_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
Loading

0 comments on commit f38d38a

Please sign in to comment.