Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Nov 12, 2024
1 parent 272ea1e commit 60fdcf5
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
run: cargo build --workspace --all-features --bins --tests --examples --benches --lib
- name: Run unit tests
shell: bash
run: cargo test -- --nocapture
run: cargo test --all-features -- --nocapture
- name: Run examples
shell: bash
run: |
Expand Down
1 change: 0 additions & 1 deletion examples/rolling_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use logforth::append::rolling_file;
use logforth::append::rolling_file::NonBlockingBuilder;
use logforth::append::rolling_file::RollingFile;
use logforth::append::rolling_file::RollingFileWriter;
use logforth::append::rolling_file::Rotation;
Expand Down
1 change: 0 additions & 1 deletion examples/syslog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use logforth::append::syslog;
use logforth::append::syslog::Syslog;
use logforth::append::syslog::SyslogWriter;
use logforth::non_blocking::NonBlockingBuilder;

fn main() {
let syslog_writer = SyslogWriter::tcp_well_known().unwrap();
Expand Down
3 changes: 2 additions & 1 deletion src/append/opentelemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ use opentelemetry::logs::LogRecord as _;
use opentelemetry::logs::Logger;
use opentelemetry::logs::LoggerProvider as ILoggerProvider;
use opentelemetry::InstrumentationScope;
use opentelemetry_otlp::LogExporter;
use opentelemetry_otlp::Protocol;
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_otlp::{LogExporter, Protocol};
use opentelemetry_sdk::logs::LogRecord;
use opentelemetry_sdk::logs::LoggerProvider;

Expand Down
1 change: 0 additions & 1 deletion src/append/rolling_file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
//! use logforth::append::rolling_file::RollingFileWriter;
//! use logforth::append::rolling_file::Rotation;
//! use logforth::layout::JsonLayout;
//! use logforth::non_blocking::NonBlockingBuilder;
//!
//! let rolling_writer = RollingFileWriter::builder()
//! .rotation(Rotation::Daily)
Expand Down
1 change: 0 additions & 1 deletion src/append/syslog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
//! use logforth::append::syslog;
//! use logforth::append::syslog::Syslog;
//! use logforth::append::syslog::SyslogWriter;
//! use logforth::non_blocking::NonBlockingBuilder;
//!
//! let syslog_writer = SyslogWriter::tcp_well_known().unwrap();
//! let (non_blocking, _guard) = syslog::non_blocking_builder().finish(syslog_writer);
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/non_blocking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod non_blocking;
mod builder;
mod worker;

pub use non_blocking::NonBlocking;
pub use non_blocking::NonBlockingBuilder;
pub use non_blocking::WorkerGuard;
pub(crate) use worker::Writer;
pub use builder::NonBlocking;
pub use builder::NonBlockingBuilder;
pub use builder::WorkerGuard;
pub use worker::Writer;

#[derive(Debug)]
enum Message {
Expand Down
5 changes: 4 additions & 1 deletion src/non_blocking/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ use crossbeam_channel::TryRecvError;

use super::Message;

pub(crate) trait Writer {
/// A trait for the writer used in non-blocking background thread.
pub trait Writer {
/// Write all the formatted record bytes to the writer.
fn write_all(&mut self, buf: &[u8]) -> io::Result<()>;
/// Flush the writer.
fn flush(&mut self) -> io::Result<()>;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/recursive_logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use logforth::append;
use logforth::append::rolling_file::NonBlockingBuilder;
use logforth::append::rolling_file;
use logforth::append::rolling_file::RollingFileWriter;
use logforth::append::rolling_file::Rotation;
use logforth::layout;
Expand All @@ -29,7 +29,7 @@ fn test_meta_logging_in_format_works() {
.max_file_size(1024 * 1024)
.build("logs")
.unwrap();
let (writer, _guard) = NonBlockingBuilder::default().finish(rolling);
let (writer, _guard) = rolling_file::non_blocking_builder().finish(rolling);

let layout = |src: &'static str| {
layout::CustomLayout::new(move |record| {
Expand Down

0 comments on commit 60fdcf5

Please sign in to comment.