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

Improved logging #123

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
125 changes: 122 additions & 3 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions brane-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ tokio-util = { version = "0.7.1", features = ["codec"] }
uuid = { version = "1.7.0", features = ["serde", "v4"] }
warp = "0.3.2"

tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

brane-cfg = { path = "../brane-cfg" }
brane-prx = { path = "../brane-prx" }
brane-shr = { path = "../brane-shr" }
Expand Down
17 changes: 7 additions & 10 deletions brane-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ use juniper::EmptySubscription;
use log::{LevelFilter, debug, error, info, warn};
use scylla::{Session, SessionBuilder};
use tokio::signal::unix::{Signal, SignalKind, signal};
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use warp::Filter;


/***** ARGUMENTS *****/
#[derive(Parser)]
#[clap(version = env!("CARGO_PKG_VERSION"))]
Expand Down Expand Up @@ -63,16 +64,12 @@ async fn main() {
dotenv().ok();
let opts = Opts::parse();

// Configure logger.
let mut logger = env_logger::builder();
logger.format_module_path(false);
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(tracing_subscriber::EnvFilter::builder().with_default_directive(tracing::level_filters::LevelFilter::WARN.into()).from_env_lossy())
.init();

if opts.debug {
logger.filter_level(LevelFilter::Debug).init();
} else {
logger.filter_level(LevelFilter::Info).init();
}
info!("Initializing brane-job v{}...", env!("CARGO_PKG_VERSION"));
tracing::info!("Initializing brane-job v{}...", env!("CARGO_PKG_VERSION"));

// Load the config, making sure it's a worker config
debug!("Loading node.yml file '{}'...", opts.node_config_path.display());
Expand Down
3 changes: 3 additions & 0 deletions brane-ctl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ brane-shr = { path = "../brane-shr" }
brane-tsk = { path = "../brane-tsk" }
specifications = { path = "../specifications" }
clap_complete = "4.5.8"
tracing = "0.1.40"

strum = "0.26.3"
strum_macros = "0.26.4"

# Hacky indeed but necessary to dodge OpenSSL linking, which we need to make cross-compilation _so_ much easier
[dependencies.openssl-sys]
Expand Down
Loading
Loading