mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 14:30:31 +08:00
Add file logger
This commit is contained in:
Generated
+30
@@ -1328,9 +1328,11 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"lexopt",
|
||||
"log",
|
||||
"radicle",
|
||||
"radicle-surf",
|
||||
"radicle-term",
|
||||
"simple-logging",
|
||||
"textwrap 0.16.0",
|
||||
"timeago",
|
||||
"tui-realm-stdlib",
|
||||
@@ -1407,6 +1409,12 @@ dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
@@ -1604,6 +1612,17 @@ dependencies = [
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simple-logging"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b00d48e85675326bb182a2286ea7c1a0b264333ae10f27a937a72be08628b542"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"thread-id",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.10"
|
||||
@@ -1828,6 +1847,17 @@ dependencies = [
|
||||
"syn 2.0.28",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread-id"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_syscall 0.1.57",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.45"
|
||||
|
||||
+2
-12
@@ -13,6 +13,8 @@ path = "src/main.rs"
|
||||
[dependencies]
|
||||
anyhow = { version = "1" }
|
||||
lexopt = { version = "0.2" }
|
||||
log = { version = "0.4.19" }
|
||||
simple-logging = { version = "2.0.2" }
|
||||
radicle = { version = "0.2.0" }
|
||||
radicle-term = { version = "0.1.0" }
|
||||
radicle-surf = { version = "0.14.0" }
|
||||
@@ -20,15 +22,3 @@ timeago = { version = "0.4.1" }
|
||||
textwrap = { version = "0.16.0" }
|
||||
tuirealm = { version = "1.8.0", default-features = false, features = [ "with-termion" ] }
|
||||
tui-realm-stdlib = { version = "1.2.0", default-features = false, features = [ "with-termion" ] }
|
||||
|
||||
# [dependencies.radicle]
|
||||
# version = "0"
|
||||
# path = "../heartwood/radicle"
|
||||
|
||||
# [dependencies.radicle-cli]
|
||||
# version = "0"
|
||||
# path = "../heartwood/radicle-cli"
|
||||
|
||||
# [dependencies.radicle-term]
|
||||
# version = "0"
|
||||
# path = "../heartwood/radicle-term"
|
||||
|
||||
+13
-7
@@ -1,7 +1,10 @@
|
||||
use std::process;
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
use log::info;
|
||||
use log::LevelFilter;
|
||||
|
||||
use radicle::profile;
|
||||
use radicle::{
|
||||
crypto::ssh::keystore::MemorySigner, prelude::Signer, profile::env::RAD_PASSPHRASE, Profile,
|
||||
};
|
||||
@@ -85,18 +88,21 @@ fn execute() -> anyhow::Result<()> {
|
||||
|
||||
let (_, id) = radicle::rad::cwd()
|
||||
.map_err(|_| anyhow!("this command must be run in the context of a project"))?;
|
||||
|
||||
let profile = profile()?;
|
||||
|
||||
let signer = signer(&profile)?;
|
||||
let storage = &profile.storage;
|
||||
|
||||
let payload = storage
|
||||
let payload = &profile
|
||||
.storage
|
||||
.get(signer.public_key(), id)?
|
||||
.context("No project with such `id` exists")?;
|
||||
|
||||
let project = payload.project()?;
|
||||
|
||||
let logfile = format!(
|
||||
"{}/radicle-tui.log",
|
||||
profile::home()?.path().to_string_lossy()
|
||||
);
|
||||
simple_logging::log_to_file(logfile, LevelFilter::Info)?;
|
||||
info!("Launching window...");
|
||||
|
||||
let mut window = Window::default();
|
||||
window.run(&mut app::App::new(profile, id, project), 1000 / FPS)?;
|
||||
|
||||
@@ -105,7 +111,7 @@ fn execute() -> anyhow::Result<()> {
|
||||
|
||||
fn main() {
|
||||
if let Err(err) = execute() {
|
||||
term::error(format!("Error: rad-tui: {err}"));
|
||||
term::error(format!("Error: radicle-tui: {err}"));
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user