Skip to content

Commit

Permalink
chore: Use the inmem logging functions in the FFI crate
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Sep 5, 2024
1 parent 9d3610d commit f5228c5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions rust/pact_ffi/src/log/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use std::str::from_utf8;
use libc::{c_char, c_int};
use log::{error, LevelFilter as LogLevelFilter};

use pact_matching::logging::fetch_buffer_contents;

use crate::error::set_error_msg;
use crate::log::inmem_buffer::fetch_buffer_contents;
use crate::log::level_filter::LevelFilter;
use crate::log::logger::{add_sink, apply_logger, init_logger};
use crate::log::sink::Sink;
Expand Down
2 changes: 1 addition & 1 deletion rust/pact_ffi/src/log/inmem_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) struct InMemBuffer { }

impl Write for InMemBuffer {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
pact_matching::logging::write_to_log_buffer(buf);
write_to_log_buffer(buf);
Ok(buf.len())
}

Expand Down
4 changes: 4 additions & 0 deletions rust/pact_ffi/src/log/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ pub use crate::log::ffi::{
pactffi_log_to_file,
pactffi_log_to_buffer
};
pub use crate::log::inmem_buffer::{
fetch_buffer_contents,
write_to_log_buffer
};
2 changes: 1 addition & 1 deletion rust/pact_ffi/src/mock_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ use tokio_rustls::rustls::ServerConfig;
use tracing::{error, warn};
use uuid::Uuid;

use pact_matching::logging::fetch_buffer_contents;
use pact_matching::metrics::{MetricEvent, send_metrics};
use pact_mock_server::{MANAGER, mock_server_mismatches, MockServerError, tls::TlsConfigBuilder, WritePactFileErr};
use pact_mock_server::mock_server::MockServerConfig;
Expand All @@ -72,6 +71,7 @@ use pact_models::generators::GeneratorCategory;
use pact_models::matchingrules::{Category, MatchingRuleCategory};

use crate::{convert_cstr, ffi_fn, safe_str};
use crate::log::fetch_buffer_contents;
use crate::mock_server::handles::{PactHandle, path_from_dir};
use crate::string::optional_str;

Expand Down
2 changes: 1 addition & 1 deletion rust/pact_ffi/src/verifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use pact_models::prelude::HttpAuth;
use regex::Regex;
use serde::{Deserialize, Serialize};

use pact_matching::logging::fetch_buffer_contents;
use pact_verifier::selectors::{consumer_tags_to_selectors, json_to_selectors};

use crate::{as_mut, as_ref, ffi_fn, RUNTIME, safe_str};
use crate::log::fetch_buffer_contents;
use crate::ptr;
use crate::util::string::{if_null, optional_str};

Expand Down

0 comments on commit f5228c5

Please sign in to comment.