mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-13 22:49:07 -05:00
fix: allow tokio tracing to be enabled
fixes https://github.com/scsibug/nostr-rs-relay/issues/48
This commit is contained in:
parent
ba987d3212
commit
0db6487ce3
|
@ -18,7 +18,7 @@ description = "A newly created nostr-rs-relay.\n\nCustomize this with your own i
|
||||||
|
|
||||||
[diagnostics]
|
[diagnostics]
|
||||||
# Enable tokio tracing (for use with tokio-console)
|
# Enable tokio tracing (for use with tokio-console)
|
||||||
#tracing = true
|
#tracing = false
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
# Directory for SQLite files. Defaults to the current directory. Can
|
# Directory for SQLite files. Defaults to the current directory. Can
|
||||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -14,22 +14,25 @@ use console_subscriber::ConsoleLayer;
|
||||||
|
|
||||||
/// Start running a Nostr relay server.
|
/// Start running a Nostr relay server.
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// configure settings from config.toml
|
||||||
|
// replace default settings with those read from config.toml
|
||||||
|
let mut settings = config::Settings::new();
|
||||||
|
|
||||||
// setup tracing
|
// setup tracing
|
||||||
let _trace_sub = tracing_subscriber::fmt::try_init();
|
if settings.diagnostics.tracing {
|
||||||
|
// enable tracing with tokio-console
|
||||||
|
ConsoleLayer::builder().with_default_env().init();
|
||||||
|
} else {
|
||||||
|
// standard logging
|
||||||
|
tracing_subscriber::fmt::try_init().unwrap();
|
||||||
|
}
|
||||||
info!("Starting up from main");
|
info!("Starting up from main");
|
||||||
|
|
||||||
let args = CLIArgs::parse();
|
let args = CLIArgs::parse();
|
||||||
|
|
||||||
// get database directory from args
|
// get database directory from args
|
||||||
let db_dir = args.db;
|
let db_dir = args.db;
|
||||||
// configure settings from config.toml
|
|
||||||
// replace default settings with those read from config.toml
|
|
||||||
let mut settings = config::Settings::new();
|
|
||||||
|
|
||||||
if settings.diagnostics.tracing {
|
|
||||||
// enable tracing with tokio-console
|
|
||||||
ConsoleLayer::builder().with_default_env().init();
|
|
||||||
}
|
|
||||||
// update with database location
|
// update with database location
|
||||||
if db_dir.len() > 0 {
|
if db_dir.len() > 0 {
|
||||||
settings.database.data_directory = db_dir;
|
settings.database.data_directory = db_dir;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user