mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-26 00:22:10 +03:00
Fix visibility Logger.
This commit is contained in:
parent
daa5e5ebd4
commit
5b8a6fb95c
@ -27,7 +27,6 @@ pub use self::options::parse_options;
|
||||
pub use self::options::{CliOptions, OutputType};
|
||||
pub use self::variables::parse as parse_variable;
|
||||
pub use self::variables::parse_value as parse_variable_value;
|
||||
pub use crate::util::logger::Logger;
|
||||
|
||||
mod fs;
|
||||
pub mod interactive;
|
||||
|
@ -57,7 +57,7 @@ pub fn parse_value(s: &str) -> Result<Value, CliError> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
@ -29,8 +29,8 @@ use super::request::*;
|
||||
use super::request_spec::*;
|
||||
use super::response::*;
|
||||
use super::{Header, HttpError, Verbosity};
|
||||
use crate::cli::Logger;
|
||||
use crate::http::ContextDir;
|
||||
use crate::util::logger::Logger;
|
||||
use base64::engine::general_purpose;
|
||||
use base64::Engine;
|
||||
use curl::easy::{List, SslOpt};
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
use crate::cli::Logger;
|
||||
use crate::util::logger::Logger;
|
||||
|
||||
/// Debug log text.
|
||||
pub fn log_text(text: &str, logger: &Logger) {
|
||||
|
@ -16,8 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use crate::cli::Logger;
|
||||
use crate::http::{debug, mimetype, Request};
|
||||
use crate::util::logger::Logger;
|
||||
|
||||
impl Request {
|
||||
/// Log request body.
|
||||
|
@ -16,8 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use crate::cli::Logger;
|
||||
use crate::http::{debug, mimetype, Response};
|
||||
use crate::util::logger::Logger;
|
||||
|
||||
impl Response {
|
||||
/// Log a response body as text if possible, or a slice of body bytes.
|
||||
|
@ -24,14 +24,14 @@ use atty::Stream;
|
||||
use clap::Command;
|
||||
use colored::*;
|
||||
|
||||
use hurl::cli::{CliError, CliOptions, Logger, OutputType};
|
||||
use hurl::cli::{CliError, CliOptions, OutputType};
|
||||
use hurl::http;
|
||||
use hurl::report;
|
||||
use hurl::report::html;
|
||||
use hurl::runner;
|
||||
use hurl::runner::HurlResult;
|
||||
use hurl::runner::RunnerOptions;
|
||||
use hurl::util::logger::{BaseLogger, LoggerBuilder};
|
||||
use hurl::util::logger::{BaseLogger, Logger, LoggerBuilder};
|
||||
use hurl::{cli, output};
|
||||
use hurl_core::ast::HurlFile;
|
||||
use hurl_core::parser;
|
||||
|
@ -15,11 +15,12 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
use crate::cli::{CliError, Logger};
|
||||
use crate::cli::CliError;
|
||||
use crate::http::Response;
|
||||
use crate::output::write_output;
|
||||
use crate::runner;
|
||||
use crate::runner::{HurlResult, RunnerError};
|
||||
use crate::util::logger::Logger;
|
||||
use colored::Colorize;
|
||||
use hurl_core::ast::SourceInfo;
|
||||
use hurl_core::error::Error;
|
||||
|
@ -18,9 +18,9 @@
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::cli::Logger;
|
||||
use crate::http;
|
||||
use crate::http::ClientOptions;
|
||||
use crate::util::logger::Logger;
|
||||
use hurl_core::ast::*;
|
||||
|
||||
use super::core::*;
|
||||
|
@ -19,18 +19,16 @@ use std::collections::HashMap;
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::cli::Logger;
|
||||
use crate::http;
|
||||
use crate::runner::entry::get_entry_verbosity;
|
||||
use crate::runner::core::*;
|
||||
use crate::runner::entry;
|
||||
use crate::runner::runner_options::RunnerOptions;
|
||||
use crate::runner::Value;
|
||||
use crate::util::logger::Logger;
|
||||
use crate::util::logger::LoggerBuilder;
|
||||
use hurl_core::ast::VersionValue::VersionAnyLegacy;
|
||||
use hurl_core::ast::*;
|
||||
|
||||
use super::core::*;
|
||||
use super::entry;
|
||||
|
||||
/// Runs a `hurl_file`, issue from the given `filename`, with
|
||||
/// an `http_client`. Returns a [`HurlResult`] upon completion.
|
||||
///
|
||||
@ -42,13 +40,12 @@ use super::entry;
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
/// use std::path::PathBuf;
|
||||
/// use hurl::cli::Logger;
|
||||
/// use hurl_core::parser;
|
||||
/// use hurl::http;
|
||||
/// use hurl::http::ContextDir;
|
||||
/// use hurl::runner;
|
||||
/// use hurl::runner::{Value, RunnerOptionsBuilder, Verbosity};
|
||||
/// use hurl::util::logger::LoggerBuilder;
|
||||
/// use hurl::util::logger::{Logger, LoggerBuilder};
|
||||
///
|
||||
/// // Parse Hurl file
|
||||
/// let filename = "sample.hurl";
|
||||
@ -112,7 +109,7 @@ pub fn run(
|
||||
// We compute these new overridden options for this entry, before entering into the `run`
|
||||
// function because entry options can modify the logger and we want the preamble
|
||||
// "Executing entry..." to be displayed based on the entry level verbosity.
|
||||
let entry_verbosity = get_entry_verbosity(entry, &runner_options.verbosity);
|
||||
let entry_verbosity = entry::get_entry_verbosity(entry, &runner_options.verbosity);
|
||||
let mut builder = LoggerBuilder::new();
|
||||
let logger = builder
|
||||
.color(logger.color)
|
||||
|
@ -18,39 +18,11 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use hurl::cli;
|
||||
use hurl::http;
|
||||
use hurl::runner;
|
||||
use hurl::runner::RunnerOptions;
|
||||
use hurl::util::logger::LoggerBuilder;
|
||||
use hurl_core::ast::*;
|
||||
use hurl_core::parser;
|
||||
|
||||
// Can be used for debugging
|
||||
#[test]
|
||||
fn test_hurl_file() {
|
||||
let filename = "../../integration/tests_ok/bom.hurl";
|
||||
let content = cli::read_to_string(filename).expect("Something went wrong reading the file");
|
||||
let hurl_file = parser::parse_hurl_file(content.as_str()).unwrap();
|
||||
let variables = HashMap::new();
|
||||
let mut client = http::Client::new(None);
|
||||
let mut builder = LoggerBuilder::new();
|
||||
let logger = builder
|
||||
.filename(filename)
|
||||
.content(&content)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let runner_options = RunnerOptions::default();
|
||||
let _hurl_log = runner::run(
|
||||
&hurl_file,
|
||||
filename,
|
||||
&mut client,
|
||||
&runner_options,
|
||||
&variables,
|
||||
&logger,
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn hello_request() -> Request {
|
||||
|
Loading…
Reference in New Issue
Block a user