Skip to content

Commit

Permalink
Add json subscriber printing to console.
Browse files Browse the repository at this point in the history
  • Loading branch information
ISibboI committed Jul 20, 2023
1 parent 3e5fb4d commit 4506e52
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
30 changes: 30 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion backend/rvoc-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tokio = {version = "1.29.1", features = []}

# logging and telemetry
tracing = "0.1.37"
tracing-subscriber = "0.3.17"
tracing-subscriber = {version = "0.3.17", features = ["fmt", "json"]}
tracing-opentelemetry = "0.19.0"

# database
Expand Down
9 changes: 7 additions & 2 deletions backend/rvoc-backend/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ use diesel_async::{
pooled_connection::{deadpool::Pool, AsyncDieselConnectionManager},
AsyncPgConnection,
};
use tokio::runtime::Builder;
use tracing::{error, info, instrument};

mod configuration;
mod error;

pub fn main() -> RVocResult<()> {
// Load configuration
let configuration = Configuration::from_environment()?;

// Setup tracing
tracing_subscriber::fmt()
.event_format(tracing_subscriber::fmt::format().json())
.init();

info!("Building tokio runtime...");
let runtime = Builder::new_current_thread()
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap_or_else(|e| panic!("Cannot create tokio runtime: {:?}", e));
Expand Down

0 comments on commit 4506e52

Please sign in to comment.