Skip to content

Commit

Permalink
Merge pull request #78 from qwerty541/lint_resolve_clippy_too_long_fi…
Browse files Browse the repository at this point in the history
…rst_doc_paragraph_on_nightly

lints: resolve too_long_first_doc_paragraph clippy lint on nightly toolchain
  • Loading branch information
qwerty541 authored Sep 8, 2024
2 parents a1f6861 + 5a7702c commit 28212d7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
12 changes: 8 additions & 4 deletions src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use itertools::Itertools;
// Trait
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// This trait allows to filter log records ([`Record`]) using [`check`] method which returns [`bool`] value.
/// It should be implemented for structures which are going to be used as filtering part inside [`LoggedStream`].
/// Trait for filtering log records in [`LoggedStream`].
///
/// This trait allows filtering log records ([`Record`]) using the [`check`] method, which returns a [`bool`] value.
/// It should be implemented for structures intended to be used as the filtering component within [`LoggedStream`].
///
/// [`check`]: RecordFilter::check
/// [`LoggedStream`]: crate::LoggedStream
Expand Down Expand Up @@ -53,8 +55,10 @@ impl RecordFilter for Box<DefaultFilter> {
// RecordKindFilter
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// This implementation of [`RecordFilter`] trait accepts allowed log record kinds ([`RecordKind`]) array during
/// construction and its [`check`] method returns `true` if received log record kind presented inside this array.
/// Implementation of [`RecordFilter`] that accepts allowed [`RecordKind`] array.
///
/// This implementation of the [`RecordFilter`] trait accepts an array of allowed log record kinds ([`RecordKind`]) during
/// construction. Its [`check`] method returns `true` if the received log record kind is present in this array.
///
/// [`check`]: RecordFilter::check
#[derive(Debug)]
Expand Down
38 changes: 24 additions & 14 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ use std::sync::mpsc;
// Trait
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// This trait allows to process log record ([`Record`]) using [`log`] method. It should be implemented for
/// structures which are going to be used as logging part inside [`LoggedStream`]. Method [`log`] is called
/// by [`LoggedStream`] for further log record processing (writing to the console, to the memory or database, etc.)
/// after log record message was formatted by some implementation of [`BufferFormatter`] and the entire log record
/// was filtered by some implementation of [`RecordFilter`].
/// Trait for processing log records in [`LoggedStream`].
///
/// This trait allows processing log records ([`Record`]) using the [`log`] method. It should be implemented for
/// structures intended to be used as the logging component within [`LoggedStream`]. The [`log`] method is called
/// by [`LoggedStream`] for further log record processing (e.g., writing to the console, memory, or database)
/// after the log record message has been formatted by an implementation of [`BufferFormatter`] and filtered
/// by an implementation of [`RecordFilter`].
///
/// [`log`]: Logger::log
/// [`LoggedStream`]: crate::LoggedStream
Expand All @@ -33,8 +35,11 @@ impl Logger for Box<dyn Logger> {
// ConsoleLogger
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// This implementation of [`Logger`] trait writes log record ([`Record`]) into console using provided [`log::Level`].
/// Log records with [`Error`] kind ignore provided [`log::Level`] and always write with [`log::Level::Error`].
/// Logger implementation that writes log records to the console.
///
/// This implementation of the [`Logger`] trait writes log records ([`Record`]) to the console using the provided
/// [`log::Level`]. Log records with the [`Error`] kind ignore the provided [`log::Level`] and are always written
/// with [`log::Level::Error`].
///
/// [`Error`]: crate::RecordKind::Error
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -77,11 +82,14 @@ impl Logger for Box<ConsoleLogger> {
// MemoryStorageLogger
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// This implementation of [`Logger`] trait writes log record ([`Record`]) into inner collection ([`collections::VecDeque`]).
/// Inner collection length limited by number provided during structure construction. You are able to retrieve
/// accumulated log records from inner collection using [`get_log_records`] method and clean inner collection
/// using [`clear_log_records`] method.
/// Logger implementation that writes log records to an inner [`VecDeque`] collection.
///
/// This implementation of the [`Logger`] trait writes log records ([`Record`]) into an inner collection
/// ([`collections::VecDeque`]). The length of the inner collection is limited by a number provided during
/// structure construction. You can retrieve accumulated log records from the inner collection using the
/// [`get_log_records`] method and clear the inner collection using the [`clear_log_records`] method.
///
/// [`VecDeque`]: collections::VecDeque
/// [`get_log_records`]: MemoryStorageLogger::get_log_records
/// [`clear_log_records`]: MemoryStorageLogger::clear_log_records
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -131,9 +139,11 @@ impl Logger for Box<MemoryStorageLogger> {
// ChannelLogger
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// This implementation of [`Logger`] trait sends log records ([`Record`]) by the sending-half of underlying
/// asynchronous channel. You are able to take receiving-half using [`take_receiver`] and [`take_receiver_unchecked`]
/// methods.
/// Logger implementation that sends log records via an asynchronous channel.
///
/// This implementation of the [`Logger`] trait sends log records ([`Record`]) using the sending-half of an underlying
/// asynchronous channel. You can obtain the receiving-half of the channel using the [`take_receiver`] and
/// [`take_receiver_unchecked`] methods.
///
/// [`take_receiver`]: ChannelLogger::take_receiver
/// [`take_receiver_unchecked`]: ChannelLogger::take_receiver_unchecked
Expand Down
8 changes: 5 additions & 3 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ use std::task::Context;
use std::task::Poll;
use tokio::io as tokio_io;

/// This is a structure that can be used as a wrapper for underlying IO object which implements [`Read`]
/// and [`Write`] traits or their asynchronous analogues from [`tokio`] library [`AsyncRead`] and
/// [`AsyncWrite`] to enable logging of all read and write operations, errors and drop.
/// Wrapper for IO objects to log all read and write operations, errors, and drop events.
///
/// This structure can be used as a wrapper for underlying IO objects that implement the [`Read`] and [`Write`] traits,
/// or their asynchronous analogues from the [`tokio`] library, [`AsyncRead`] and [`AsyncWrite`]. It enables logging
/// of all read and write operations, errors, and drop events.
///
/// [`LoggedStream`] structure constructs from four parts:
///
Expand Down

0 comments on commit 28212d7

Please sign in to comment.