added file appender

This commit is contained in:
SyntheticBird45 2024-06-19 11:29:21 +02:00
parent 28f1b70d7e
commit e3b700529f
Signed by untrusted user who does not match committer: SyntheticBird
GPG key ID: C76973F748521E11
4 changed files with 72 additions and 1 deletions

65
Cargo.lock generated
View file

@ -623,6 +623,7 @@ dependencies = [
"tokio-util",
"tower",
"tracing",
"tracing-appender",
"tracing-subscriber",
]
@ -743,6 +744,15 @@ dependencies = [
name = "database"
version = "0.0.0"
[[package]]
name = "deranged"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
[[package]]
name = "diff"
version = "0.1.13"
@ -1578,6 +1588,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-traits"
version = "0.2.18"
@ -1785,6 +1801,12 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7"
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@ -2431,6 +2453,37 @@ dependencies = [
"once_cell",
]
[[package]]
name = "time"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
"num-conv",
"time-core",
]
[[package]]
name = "tiny-keccak"
version = "2.0.2"
@ -2601,6 +2654,18 @@ dependencies = [
"tracing-core",
]
[[package]]
name = "tracing-appender"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf"
dependencies = [
"crossbeam-channel",
"thiserror",
"time",
"tracing-subscriber",
]
[[package]]
name = "tracing-attributes"
version = "0.1.27"

View file

@ -38,6 +38,7 @@ hex = { workspace = true, features = ["std"] }
tracing = { workspace = true, features = ["std", "attributes"] }
tracing-subscriber = "0.3.18"
tracing-appender = "0.2.3"
[dev-dependencies]
cuprate-test-utils = { path = "../../test-utils" }

View file

@ -21,6 +21,7 @@ use monero_p2p::{PeerRequest, PeerResponse};
use monero_wire::admin::TimedSyncResponse;
use rayon::iter::IntoParallelIterator;
use rayon::prelude::*;
use tracing_appender::rolling::{RollingFileAppender, Rotation};
use std::collections::HashMap;
use std::future::Future;
use std::path::PathBuf;
@ -192,9 +193,13 @@ async fn main() {
.await
.unwrap();
let file_appender = RollingFileAppender::new(Rotation::NEVER, "/var/log/cuprate/", "cuprate.log");
let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender);
tracing_subscriber::fmt()
.with_max_level(Level::DEBUG)
.with_max_level(Level::INFO)
.with_timer(Uptime::default())
.with_writer(non_blocking)
.init();
let config = P2PConfig::<ClearNet> {

BIN
p2p_store

Binary file not shown.