logging improvements

*   allow debug/trace logging on release builds again
*   enable log messages from hyper. I didn't notice they went
    away with 0.14.0, although there's a breaking change in the log:
    https://github.com/hyperium/hyper/blob/master/CHANGELOG.md#v0140-2020-12-23
*   downgrade some particularly spammy messages
This commit is contained in:
Scott Lamb
2021-06-04 23:28:48 -07:00
parent 7591146928
commit 9cc63faf29
6 changed files with 27 additions and 15 deletions

View File

@@ -1111,8 +1111,8 @@ impl FileBuilder {
self.body.buf.len()
);
}
debug!("segments: {:#?}", self.segments);
debug!("slices: {:?}", self.body.slices);
trace!("segments: {:#?}", self.segments);
trace!("slices: {:?}", self.body.slices);
let last_modified =
::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(max_end as u64);
let etag = etag.finalize();
@@ -1410,7 +1410,7 @@ impl FileBuilder {
flushed.push(unflushed);
debug!("Using edit list: {:?}", flushed);
trace!("Using edit list: {:?}", flushed);
write_length!(self, {
self.body.buf.extend_from_slice(b"edts");
write_length!(self, {

View File

@@ -6,7 +6,7 @@ use crate::h264;
use cstr::cstr;
use failure::{bail, Error};
use lazy_static::lazy_static;
use log::{debug, warn};
use log::warn;
use std::convert::TryFrom;
use std::ffi::CString;
use std::result::Result;
@@ -117,7 +117,6 @@ impl Opener<FfmpegStream> for Ffmpeg {
let s = input.streams();
for i in 0..s.len() {
if s.get(i).codecpar().codec_type().is_video() {
debug!("Video stream index is {}", i);
video_i = Some(i);
break;
}

View File

@@ -135,10 +135,6 @@ where
let _t = TimerGuard::new(&clocks, || "inserting video sample entry");
self.db.lock().insert_video_sample_entry(extra_data.entry)?
};
debug!(
"{}: video_sample_entry_id={}",
self.short_name, video_sample_entry_id
);
let mut seen_key_frame = false;
// Seconds since epoch at which to next rotate.

View File

@@ -19,7 +19,7 @@ use http::header::{self, HeaderValue};
use http::{status::StatusCode, Request, Response};
use http_serve::dir::FsDir;
use hyper::body::Bytes;
use log::{debug, info, warn};
use log::{debug, info, trace, warn};
use memchr::memchr;
use nom::bytes::complete::{tag, take_while1};
use nom::combinator::{all_consuming, map, map_res, opt};
@@ -836,7 +836,7 @@ impl Service {
format!("invalid s parameter: {}", value),
)
})?;
debug!("stream_view_mp4: appending s={:?}", s);
trace!("stream_view_mp4: appending s={:?}", s);
let mut est_segments = usize::try_from(s.ids.end - s.ids.start).unwrap();
if let Some(end) = s.end_time {
// There should be roughly ceil((end - start) /
@@ -887,10 +887,12 @@ impl Service {
let start = cmp::max(0, s.start_time - cur_off);
let end = cmp::min(wd, end_time - cur_off);
let wr = i32::try_from(start).unwrap()..i32::try_from(end).unwrap();
debug!(
trace!(
"...appending recording {} with wall duration {:?} \
(out of total {})",
r.id, wr, wd
r.id,
wr,
wd
);
if start_time_for_filename.is_none() {
start_time_for_filename =
@@ -906,7 +908,7 @@ impl Service {
);
builder.append(&db, r, mr, true)?;
} else {
debug!("...skipping recording {} wall dur {}", r.id, wd);
trace!("...skipping recording {} wall dur {}", r.id, wd);
}
cur_off += wd;
Ok(())