mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-28 21:18:11 -05:00
switch from log to tracing
I think this is a big improvement in readability. I removed the `lnav` config, which is a little sad, but I don't think it supports this structured logging format well. Still seems worthwhile on balance.
This commit is contained in:
@@ -110,7 +110,7 @@ fn get_camera(siv: &mut Cursive) -> Camera {
|
||||
sample_file_dir_id,
|
||||
};
|
||||
}
|
||||
log::trace!("camera is: {:#?}", &camera);
|
||||
tracing::trace!("camera is: {:#?}", &camera);
|
||||
camera
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ fn load_camera_values(
|
||||
v.set_content(s.config.flush_if_sec.to_string())
|
||||
});
|
||||
}
|
||||
log::debug!("setting {} dir to {}", t.as_str(), selected_dir);
|
||||
tracing::debug!("setting {} dir to {}", t.as_str(), selected_dir);
|
||||
dialog.call_on_name(
|
||||
&format!("{}_sample_file_dir", t),
|
||||
|v: &mut views::SelectView<Option<i32>>| v.set_selection(selected_dir),
|
||||
|
||||
@@ -9,12 +9,12 @@ use cursive::Cursive;
|
||||
use cursive::{views, With};
|
||||
use db::writer;
|
||||
use failure::Error;
|
||||
use log::{debug, trace};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
use super::tab_complete::TabCompleteEditView;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
use cursive::traits::{Nameable, Resizable};
|
||||
use cursive::views;
|
||||
use cursive::Cursive;
|
||||
use log::info;
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
/// Builds a `UserChange` from an active `edit_user_dialog`.
|
||||
fn get_change(
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
use bpaf::Bpaf;
|
||||
use failure::Error;
|
||||
use log::info;
|
||||
use std::path::PathBuf;
|
||||
use tracing::info;
|
||||
|
||||
/// Initializes a database.
|
||||
#[derive(Bpaf, Debug)]
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
use db::dir;
|
||||
use failure::{Error, Fail};
|
||||
use log::info;
|
||||
use nix::fcntl::FlockArg;
|
||||
use std::path::Path;
|
||||
use tracing::info;
|
||||
|
||||
pub mod check;
|
||||
pub mod config;
|
||||
|
||||
@@ -11,8 +11,6 @@ use db::{dir, writer};
|
||||
use failure::{bail, Error, ResultExt};
|
||||
use fnv::FnvHashMap;
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
use log::error;
|
||||
use log::{info, warn};
|
||||
use retina::client::SessionGroup;
|
||||
use std::net::SocketAddr;
|
||||
use std::path::Path;
|
||||
@@ -20,6 +18,8 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use tokio::signal::unix::{signal, SignalKind};
|
||||
use tracing::error;
|
||||
use tracing::{info, warn};
|
||||
|
||||
use self::config::ConfigFile;
|
||||
|
||||
@@ -342,15 +342,18 @@ async fn inner(
|
||||
rotate_offset_sec,
|
||||
streamer::ROTATE_INTERVAL_SEC,
|
||||
)?;
|
||||
info!("Starting streamer for {}", streamer.short_name());
|
||||
let name = format!("s-{}", streamer.short_name());
|
||||
let span = tracing::info_span!("streamer", stream = streamer.short_name());
|
||||
let thread_name = format!("s-{}", streamer.short_name());
|
||||
let handle = handle.clone();
|
||||
streamers.push(
|
||||
thread::Builder::new()
|
||||
.name(name)
|
||||
.name(thread_name)
|
||||
.spawn(move || {
|
||||
let _enter = handle.enter();
|
||||
streamer.run();
|
||||
span.in_scope(|| {
|
||||
let _enter_tokio = handle.enter();
|
||||
info!("starting");
|
||||
streamer.run();
|
||||
})
|
||||
})
|
||||
.expect("can't create thread"),
|
||||
);
|
||||
@@ -402,7 +405,7 @@ async fn inner(
|
||||
move || {
|
||||
for streamer in streamers.drain(..) {
|
||||
if streamer.join().is_err() {
|
||||
log::error!("streamer panicked; look for previous panic message");
|
||||
tracing::error!("streamer panicked; look for previous panic message");
|
||||
}
|
||||
}
|
||||
if let Some(mut ss) = syncers {
|
||||
|
||||
Reference in New Issue
Block a user