Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use right level of error for .env file and duplicated service #1372

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 3 additions & 15 deletions bin/fuel-core/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ use std::{
path::PathBuf,
str::FromStr,
};
use tracing::{
info,
warn,
};
use tracing_subscriber::{
filter::EnvFilter,
layer::SubscriberExt,
Expand All @@ -17,8 +13,6 @@ use tracing_subscriber::{

#[cfg(feature = "env")]
use dotenvy::dotenv;
#[cfg(feature = "env")]
use tracing::error;

lazy_static::lazy_static! {
pub static ref DEFAULT_DB_PATH: PathBuf = dirs::home_dir().unwrap().join(".fuel").join("db");
Expand Down Expand Up @@ -51,13 +45,7 @@ pub const HUMAN_LOGGING: &str = "HUMAN_LOGGING";

#[cfg(feature = "env")]
fn init_environment() -> Option<PathBuf> {
match dotenv() {
Ok(path) => Some(path),
Err(e) => {
error!("Unable to load .env environment variables: {e}. Please check that you have created a .env file in your working directory.");
Voxelot marked this conversation as resolved.
Show resolved Hide resolved
None
}
}
dotenv().ok()
}

#[cfg(not(feature = "env"))]
Expand Down Expand Up @@ -114,13 +102,13 @@ pub async fn run_cli() -> anyhow::Result<()> {
init_logging().await?;
if let Some(path) = init_environment() {
let path = path.display();
info!("Loading environment variables from {path}");
tracing::info!("Loading environment variables from {path}");
}
let opt = Opt::try_parse();
if opt.is_err() {
let command = run::Command::try_parse();
if let Ok(command) = command {
warn!("This cli format for running `fuel-core` is deprecated and will be removed. Please use `fuel-core run` or use `--help` for more information");
tracing::warn!("This cli format for running `fuel-core` is deprecated and will be removed. Please use `fuel-core run` or use `--help` for more information");
return run::exec(command).await
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/client/src/client/schema/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub struct MessageProof {
pub struct MessageProofArgs {
/// Transaction id that contains the output message.
pub transaction_id: TransactionId,
/// Message id of the output message that requires a proof.
/// The `Nonce` identifier of the output message that requires a proof.
pub nonce: Nonce,

/// The query supports either `commit_block_id`, or `commit_block_height` set on, not both.
Expand Down
2 changes: 1 addition & 1 deletion crates/metrics/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl ServicesMetrics {
encode(&mut encoded_bytes, lock.deref())
.expect("Unable to decode service metrics");
if encoded_bytes.contains(service_name) {
tracing::error!("Service with '{}' name is already registered", service_name);
tracing::warn!("Service with '{}' name is already registered", service_name);
}

lock.register(
Expand Down
6 changes: 3 additions & 3 deletions crates/services/consensus_module/poa/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ use tokio::{
time::Instant,
};
use tokio_stream::StreamExt;
use tracing::error;

pub type Service<T, B, I> = ServiceRunner<MainTask<T, B, I>>;
#[derive(Clone)]
Expand Down Expand Up @@ -305,9 +304,10 @@ where

let mut tx_ids_to_remove = Vec::with_capacity(skipped_transactions.len());
for (tx_id, err) in skipped_transactions {
error!(
tracing::error!(
"During block production got invalid transaction {:?} with error {:?}",
tx_id, err
tx_id,
err
);
tx_ids_to_remove.push(tx_id);
}
Expand Down
11 changes: 3 additions & 8 deletions crates/services/p2p/src/behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ use libp2p::{
Multiaddr,
PeerId,
};
use tracing::{
debug,
error,
warn,
};

#[derive(Debug)]
pub enum FuelBehaviourEvent {
Expand Down Expand Up @@ -169,16 +164,16 @@ impl<Codec: NetworkCodec> FuelBehaviour<Codec> {
acceptance,
) {
Ok(true) => {
debug!(target: "fuel-p2p", "Sent a report for MessageId: {} from PeerId: {}", msg_id, propagation_source);
tracing::debug!(target: "fuel-p2p", "Sent a report for MessageId: {} from PeerId: {}", msg_id, propagation_source);
if should_check_score {
return self.gossipsub.peer_score(propagation_source)
}
}
Ok(false) => {
warn!(target: "fuel-p2p", "Message with MessageId: {} not found in the Gossipsub Message Cache", msg_id);
tracing::warn!(target: "fuel-p2p", "Message with MessageId: {} not found in the Gossipsub Message Cache", msg_id);
}
Err(e) => {
error!(target: "fuel-p2p", "Failed to report Message with MessageId: {} with Error: {:?}", msg_id, e);
tracing::error!(target: "fuel-p2p", "Failed to report Message with MessageId: {} with Error: {:?}", msg_id, e);
}
}

Expand Down
Loading