mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 12:13:27 +00:00
(chore): added better loggin
This commit is contained in:
parent
dd77aabc47
commit
d11b9d0f15
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -5,9 +5,12 @@
|
|||
"consts",
|
||||
"countup",
|
||||
"creationdate",
|
||||
"dotenv",
|
||||
"dotenvy",
|
||||
"fontsource",
|
||||
"ipfs",
|
||||
"Keepsafe",
|
||||
"nodestate",
|
||||
"pathctx",
|
||||
"prismjs",
|
||||
"proptype",
|
||||
|
|
42
Cargo.lock
generated
42
Cargo.lock
generated
|
@ -1277,6 +1277,15 @@ dependencies = [
|
|||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
|
@ -1342,6 +1351,15 @@ dependencies = [
|
|||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e851a83c30366fd01d75b913588e95e74a1705c1ecc5d58b1f8e1a6d556525f"
|
||||
dependencies = [
|
||||
"dirs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.8"
|
||||
|
@ -1487,6 +1505,19 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "exr"
|
||||
version = "1.4.2"
|
||||
|
@ -2320,6 +2351,12 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.19"
|
||||
|
@ -4817,6 +4854,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"core-derive",
|
||||
"data-encoding",
|
||||
"env_logger",
|
||||
"ffmpeg-next",
|
||||
"fs_extra",
|
||||
"futures",
|
||||
|
@ -5212,6 +5250,8 @@ dependencies = [
|
|||
name = "spacedrive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dotenvy",
|
||||
"env_logger",
|
||||
"sdcore",
|
||||
"swift-rs",
|
||||
"tauri",
|
||||
|
@ -6171,7 +6211,7 @@ version = "1.6.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if 1.0.0",
|
||||
"rand 0.8.5",
|
||||
"static_assertions",
|
||||
]
|
||||
|
|
1
apps/desktop/src-tauri/.env.example
Normal file
1
apps/desktop/src-tauri/.env.example
Normal file
|
@ -0,0 +1 @@
|
|||
RUST_LOG=spacedrive=debug,sdcore=debug
|
|
@ -21,6 +21,8 @@ sdcore = { path = "../../../core" }
|
|||
# Universal Dependencies
|
||||
tokio = { version = "1.17.0", features = ["sync"] }
|
||||
window-shadows = "0.1.2"
|
||||
env_logger = "0.9.0"
|
||||
dotenvy = "0.15.1"
|
||||
|
||||
# macOS system libs
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use std::time::{Duration, Instant};
|
||||
|
||||
use dotenvy::dotenv;
|
||||
use sdcore::{ClientCommand, ClientQuery, CoreController, CoreEvent, CoreResponse, Node};
|
||||
use tauri::api::path;
|
||||
use tauri::Manager;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos;
|
||||
mod menu;
|
||||
|
@ -45,6 +45,9 @@ async fn app_ready(app_handle: tauri::AppHandle) {
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
env_logger::init();
|
||||
|
||||
let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./"));
|
||||
// create an instance of the core
|
||||
let (mut node, mut event_receiver) = Node::new(data_dir).await;
|
||||
|
|
|
@ -34,10 +34,11 @@ thiserror = "1.0.30"
|
|||
core-derive = { path = "./derive" }
|
||||
|
||||
tokio = { version = "1.17.0", features = ["sync", "rt"] }
|
||||
include_dir = {version = "0.7.2", features = ["glob"]}
|
||||
include_dir = { version = "0.7.2", features = ["glob"] }
|
||||
async-trait = "0.1.52"
|
||||
image = "0.24.1"
|
||||
webp = "0.2.2"
|
||||
ffmpeg-next = "5.0.3"
|
||||
fs_extra = "1.2.0"
|
||||
log = "0.4.17"
|
||||
log = { version = "0.4.17", features = ["max_level_trace"] }
|
||||
env_logger = "0.9.0"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::sys::{create_location, LocationResource};
|
||||
use crate::CoreContext;
|
||||
use chrono::{DateTime, FixedOffset, Utc};
|
||||
use log::{error, info};
|
||||
use prisma_client_rust::prisma_models::PrismaValue;
|
||||
use prisma_client_rust::raw;
|
||||
use prisma_client_rust::raw::Raw;
|
||||
|
@ -74,13 +75,13 @@ pub async fn scan_path(
|
|||
let entry = match entry {
|
||||
Ok(entry) => entry,
|
||||
Err(e) => {
|
||||
println!("Error reading file {}", e);
|
||||
error!("Error reading file {}", e);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let path = entry.path();
|
||||
|
||||
println!("found: {:?}", path);
|
||||
info!("Found filesystem path: {:?}", path);
|
||||
|
||||
let parent_path = path
|
||||
.parent()
|
||||
|
@ -92,7 +93,7 @@ pub async fn scan_path(
|
|||
let path_str = match path.as_os_str().to_str() {
|
||||
Some(path_str) => path_str,
|
||||
None => {
|
||||
println!("Error reading file {}", &path.display());
|
||||
error!("Error reading file {}", &path.display());
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
@ -144,15 +145,13 @@ pub async fn scan_path(
|
|||
match prepare_values(&file_path, *file_id, &location, parent_dir_id, *is_dir) {
|
||||
Ok(values) => values.to_vec(),
|
||||
Err(e) => {
|
||||
println!("Error creating file model from path {:?}: {}", file_path, e);
|
||||
error!("Error creating file model from path {:?}: {}", file_path, e);
|
||||
continue;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
println!("Creating {} file paths. {:?}", files.len(), files);
|
||||
|
||||
let raw = Raw::new(
|
||||
&format!("
|
||||
INSERT INTO file_paths (id, is_dir, location_id, materialized_path, name, extension, parent_id, date_created)
|
||||
|
@ -165,9 +164,9 @@ pub async fn scan_path(
|
|||
|
||||
let count = db._execute_raw(raw).await;
|
||||
|
||||
println!("Inserted {:?} records", count);
|
||||
info!("Inserted {:?} records", count);
|
||||
}
|
||||
println!(
|
||||
info!(
|
||||
"scan of {:?} completed in {:?}. {:?} files found. db write completed in {:?}",
|
||||
&path,
|
||||
scan_read_time,
|
||||
|
|
|
@ -8,6 +8,7 @@ use crate::{
|
|||
CoreContext,
|
||||
};
|
||||
use int_enum::IntEnum;
|
||||
use log::info;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, fmt::Debug, sync::Arc};
|
||||
use tokio::sync::Mutex;
|
||||
|
@ -38,6 +39,8 @@ impl Jobs {
|
|||
pub async fn ingest(&mut self, ctx: &CoreContext, job: Box<dyn Job>) {
|
||||
// create worker to process job
|
||||
if self.running_workers.len() < MAX_WORKERS {
|
||||
info!("Running job: {:?}", job.name());
|
||||
|
||||
let worker = Worker::new(job);
|
||||
let id = worker.id();
|
||||
|
||||
|
|
Loading…
Reference in a new issue